Language Workbench in Visual Studio


This is far from polished and complete but here you can see the grammar defined in foo.g being dynamically compiled and used to parse the text in the grammar console. You can see how the [Keyword] attribute is used to generate syntax highlighting in that grammar window also, as well as automatic error generation for the errant ‘!’.

Next up is visualization of the node graph produced by the parse as well as error information. Very promising progress though!

Author: justinmchase

I'm a Software Developer from Minnesota.

7 thoughts on “Language Workbench in Visual Studio”

  1. Looking better and better! I checked out the code last night and started fumbling around trying to set it up, but I had a hard time of it. Any chance of adding setup instructions or an automated rake/make/nant/whatever-file?

  2. Good idea I will do that. The quick instructions are that there is a environment.bat file in the root and if you run it, it does a few things. After that you can run commands such as “build” and “build test”. If you were to open /src/metasharp.sln then if you put the startup project as the visual studio integration project you can hit F5 to run the vsix in experimental mode. I should make a command to install the vsix to the main branch now that you mention it.

  3. Cool, I’ve give that a shot. Any chance of bringing this to MonoDevelop, so I don’t have to boot into Windows?

  4. I think the core library should build in mono… it has minimal dependencies, but I haven’t tried it yet. The VS extension stuff obviously will not though. I have never made a mono develop plugin but I would be interested in trying it. I would like to get what I’m currently working on to a better state of completion before attempting that too but it would definitely be cool. But it’s not an instantaneous process that’s for sure…

    I’m working up to a v0.1 but after that the direction to go is not at all set in stone.

  5. I’d like to get involved. I’m using Mono on OS X 10.7, so I’m a pretty interesting test user. Hit me up on AIM/MSN/Gmail, it’s all the same as my username here.

    I tried your instructions and had the following issues:

    1) I’m rockin XP, and your run action specifies “C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe”, which doesn’t exist for me. I recommend changing that to rely on an env var.

    2) I saw 4 errors when I ran build test.

    Build FAILED.

    “C:\cygwin\home\Mike\hg\metasharp\build.proj” (test target) (1) ->
    (Test target) ->
    C:\cygwin\home\Mike\hg\metasharp\build.proj(63,9): error : MetaSharp.Transfor
    mation.Tests.Patterns.MetadataTests.GetsMetadataOnceForRuleMultipleTimes: Asser
    t.Equal() Failure
    C:\cygwin\home\Mike\hg\metasharp\build.proj(63,9): error : Expected: 2
    C:\cygwin\home\Mike\hg\metasharp\build.proj(63,9): error : Actual: 3
    C:\cygwin\home\Mike\hg\metasharp\build.proj(63,9): error : at MetaSharp.Tr
    ) in C:\cygwin\home\Mike\hg\metasharp\src\MetaSharp.Transformation.Tests\Patter
    ns\MetadataTests.cs:line 33
    C:\cygwin\home\Mike\hg\metasharp\build.proj(63,9): error : MetaSharp.Transfor
    mation.Tests.Patterns.MetadataTests.CanGetMetadataAcrossMultipleSteps: Assert.E
    qual() Failure
    C:\cygwin\home\Mike\hg\metasharp\build.proj(63,9): error : Expected: 2
    C:\cygwin\home\Mike\hg\metasharp\build.proj(63,9): error : Actual: 3
    C:\cygwin\home\Mike\hg\metasharp\build.proj(63,9): error : at MetaSharp.Tr
    ansformation.Tests.Patterns.MetadataTests.CanGetMetadataAcrossMultipleSteps() i
    n C:\cygwin\home\Mike\hg\metasharp\src\MetaSharp.Transformation.Tests\Patterns\
    MetadataTests.cs:line 48

    0 Warning(s)
    4 Error(s)

    Time Elapsed 00:02:03.47

    3) I started up an experimental instance, opened up SongBuilder, opened up SongParser.g and saw this exception:

    That last one is the killer, and means I can’t go any further.

  6. 1.) Ok no problem.
    2.) UGH. Looks like I broke some tests in my late night hacking. You get sloppy when you don’t think anyone is going to run it! But those look like legit unit test failures. Though if it was an XP specific thing that would be VERY interesting.
    3.) that is kind of scary. Usually when you see MethodMissingException what you have is a confusion between two assemblies. Where you build it against one but what you get is another during runtime… Basically you could have parts of an older version of the extension installed? Try uninstalling the extension from the experimental instance via the extensions dialog then going into …\AppData\Local\Microsoft\VisualStudio10Exp\Extensions\MetaSharp and deleting everything in there.

    Sorry about the woes!

Drop a brain bomb

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.