The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

.Net Parser generator?

Ok, maybe this belings in the .Net section, but I don't see much traffic there.

Does anyone know if there exists a parser generator that uses the CodeDOM to generate code for any language with a CodeProvider?  I personally think that would be pretty cool.  (Might be a little tricky to do code snippets, though...maybe using a serialized form of CodeDOM bits though.  Hmm...)
Aaron F Stanton Send private email
Friday, December 03, 2004
 
 
Could you be more explicit about what you're asking? A parser generator is used to create a program to recognize a language.

The CodeDOM stuff is used to generate code in a particular language. They're opposite technologies.

Do you want to have a parser that reads a language and generates the appropriate CodeDOM object graph or something?
Chris Tavares Send private email
Friday, December 03, 2004
 
 
No, what I want is a program that reads in a grammar and outputs a parser for that grammar (like yacc/bison, antlr, or javacc does), but the parser it spits out is in a language of the user's choice.  ANTLR is somewhat configurable in the output language, and there are varieties of bison that do c++ as opposed to the default c, and javacc I believe is Java only.  I want one that you can pass a command line argument to (like you can several of the .Net tools, like WSDL) that tells you a CodeDOMProvider so that it can output the parser in an arbitrary language, so long as there is a Provider for said output language.

I hope that makes some kind of sense.  It's a Monday and I may not be totally coherent yet.
Aaron F Stanton Send private email
Monday, December 06, 2004
 
 
Though what you suggested is a cool idea, too.
Aaron F Stanton Send private email
Monday, December 06, 2004
 
 
Arron: "Spits the parser out in the user's language of choice"?

This means the poor parser-generator guy would have had to implement his parser in whatever language the user might want.

Generating a parser-generator ONCE is quite difficult.  Allowing choice of the output language means implementing it multiple times.

Each language has different 'built-in' calls, different library calls, different API's.  I'm afraid you are asking for yet another Holy Grail.
AllanL5
Monday, December 06, 2004
 
 
"implement his parser OUTPUT in each language of choice", I meant.
AllanL5
Monday, December 06, 2004
 
 
AllanL5 -

It doesn't necessarily have to be done more than once.  If you build a CodeDOM tree that represents the parser for the input grammar and then hand that tree off to the CodeDOMProvider (the Generator part, in particular, I think), it should be able to emit source code in the language desired.

Yes, different languages may require different API calls, and I probably should have posted this in the .Net forum (see my first post), but since I'm using CodeDOM and therefore .Net, the underlying .Net API should be available regardless of the language emitted.  If the language has a CodeDOMProvider, it should be able to access the .Net API with no problem, which is why I think this should be possible.

The tricky part may be in building a CodeDOM tree on the fly that represents the parser, but that's not all that different from what parser generators already do.  So long as you confine the generated tree to the minimal subset of the CodeDOM that must be supported to have a working Provider, you should be fine.

I'm getting the feeling that there is no such animal out there.
Aaron F Stanton Send private email
Monday, December 06, 2004
 
 
You might find some information here:

http://www.gotdotnet.com/team/lang/

Certainly it's the main source outside of msdn I know regarding .NET languages. There's a mailing list as well. Of course Reflector will output in your language of choice, providing you have a disassembler, but then that's not what your after.

Are you not just asking for code generation, or do I misunderstand?
el
Thursday, December 09, 2004
 
 
"but then that's not what your after" read "you're after".

Yesterday was a holiday here, so it feels like Monday.
el
Thursday, December 09, 2004
 
 
Not just asking for code generation, no.  I've done some of that.  What I'm hoping for is a parser generator.

Most parser generators emit the parser in only one language.  ANTLR is the only one I know of that does several, and it doesn't seem easily extensible.  I want one that emits a parser in any language that I have a CodeDomProvider for.
Aaron F Stanton Send private email
Thursday, December 09, 2004
 
 
Thanks for the link, btw.
Aaron F Stanton Send private email
Thursday, December 09, 2004
 
 
Take a look at grammatica by Per Cederberg at http://www.gnu.org/non-gnu/grammatica/.
Watsh Rajneesh Send private email
Friday, December 10, 2004
 
 
Hi -

It wasn't there, but I found it at http://www.nongnu.org/grammatica/index.html intact.  It looks interesting.  Thanks!
Aaron F Stanton Send private email
Friday, December 10, 2004
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz