How Do I Videos on MSDN

Coordinator
Jul 17, 2008 at 5:00 PM
Edited Jul 17, 2008 at 5:01 PM
Check this out:
http://msdn.microsoft.com/en-us/vstudio/bb507746.aspx#extensibility

Especially the one related to integrating intellisense. I've seen some of these videos in the past and found them to be nominally useful but they're showing off something I haven't seen before, mostly the "Managed Babel" stuff which looks VERY interesting. I'm not saying we should drop what we're doing and go down that route but I sort of wish we knew about it before we started this, it might have saved us a few headaches... maybe next time!


Coordinator
Jul 18, 2008 at 8:19 AM
Yeah, seen that before... I watched the video a while ago and was wholly unimpressed. As usual with Microsoft products, Babel seems to make the easy stuff easier, but leaves the hard stuff alone. The keyword intellisense that's implemented in that video is easy anyway, the hard bit is determining scope and resolving types against a token, and nothing what I've seen in Babel helps with that. As far as I've gathered, it just has some base classes for the parser and lexer, and then code gens some of the classes ontop of that. None of which is particularily difficult.

I know you've done NBusiness, so what appeals to you about Babel? Maybe I've missed something :)

The main thing that stands out to me, and maybe it's a flaw in my perspective, is the use of the lexer to produce the intellisense declarations seems like a bad idea. The lexer works at a very low-level in the source file, dealing literally with characters and tokens. I can't see how that'd pan out for working with scope, visibility, base classes, and basically anything involving types.
Coordinator
Jul 18, 2008 at 12:58 PM
Interesting, actually the only thing that really stood out to me was how they had the .lex and .y files right in the project. That's really that part that intrigues me the most. Previously, in visual studio 2005, there was no support for that step and you were basically on your own. I'd be pretty happy if they actually had msbuild tasks for compiling those and generating your parser.

Frankly, I'm an amature when it comes to parsers and languages and when I first started NBusiness I found the prospect of trying to figure out a lexer and parser generator and how to integrate it all into a Visual Studio langage project to be totally impenetrable... at the time I viewed it as being basically "just complex string parsing" so I wrote my own parser from scratch :) Well it was an fun experience and for a declarative DSL it's not really that hard but for anything more complex it would be a nightmare and I really aught to learn a way to actually use tools that were invented 40 years ago for exactly this purpose... It's just such an impenetrable process it seems. Programming language development remains to be merely for the sadistically intellectual.
Coordinator
Jul 18, 2008 at 9:57 PM
Am I correct in thinking NBusiness has it's own language? One that you've designed yourself? If that's true then I could see how Babel could be appealing. I guess it seemed less interesting to me because Boo already has it's own parser and lexer, the Boo guys have already done all that leg work, so we had a pretty good base to work from. That's not to say we haven't had our share of trouble, but I don't think it's something Babel would have been able to help us with.

None-the-less, I can see your point now. If I were creating a plugin for a new language, then having the lexer generated would certainly be an interesting prospect.
Coordinator
Jul 19, 2008 at 4:14 AM


jagregory wrote:
Am I correct in thinking NBusiness has it's own language? One that you've designed yourself? If that's true then I could see how Babel could be appealing. I guess it seemed less interesting to me because Boo already has it's own parser and lexer, the Boo guys have already done all that leg work, so we had a pretty good base to work from. That's not to say we haven't had our share of trouble, but I don't think it's something Babel would have been able to help us with.

None-the-less, I can see your point now. If I were creating a plugin for a new language, then having the lexer generated would certainly be an interesting prospect.


Yes good point, BooLangStudio is a little easier than a from scratch language since most of the major parsing and compiling stuff is already done. NBusiness basically is an external DSL, which is why I became so interested in Boo. Because doing an external DSL for languages like C# and VB made me think about the possibility of having a language that could allow you to design a DSL directly in the langage, and then I found Boo! So the next phase of the project will probably be to do NBusiness as a Boo DSL... which will be very interesting.

Of course the DSL is only one part of it but I would have loved to have a simple way to get started with the parser and lexer earlier on. Now I'll probably have to retrofit everything to accomodate it... or just stick with the custom parser which is actually working pretty well. It turns out that parsing declarative DSL type language is pretty easy really. Things are very sequential, you only have to do two passes to figure everything out. The hard parts of the project are the fact that it uses templates and works with arbitrary underlying frameworks. So for example if you want to have intellisense about what valiation rules are available you have to somehow search the available projects and assemblies for validation rules but different frameworks use different systems for validation so it's really challenging to get that information. Like NBusiness comes with a light weight framework that uses interfaces, CSLA uses delegates other frameworks use Attribute based validation... it's evil really.
 I've been trying to imagine how this would work in Boo. Right now I'm use NVelocity to generate classes... in boo you'd have a totally different template scheme because you're not generating code but an AST. Which, as we all know, is superior but it's just very different.

Anyway in case you're curious here is an example of the syntax:
http://www.codeplex.com/NBusiness/Wiki/View.aspx?title=A%20simple%20entity

I need to update that wiki... I wrote that before I knew the difference between a DSL and a real programming language. Sometimes you just have to jump in and sound like an idiot to learn something new :)