[antlr-interest] C# working version
Terence Parr
parrt at cs.usfca.edu
Fri Mar 5 10:34:14 PST 2004
Awesome :) Heh, can you post a link to your work at antlr.org under
grammars?
Ter
On Mar 5, 2004, at 3:19 AM, Robin Debreuil wrote:
> Hey all,
>
> I have the latest version of the C# parser up - it now puts the tokens
> into
> tree form. The AST is modeled fairly closely on the codeDom, other
> than what
> is missing in there. It is using classes for each node type, except
> for some
> low level ops/literals etc. I have been altering the C# antlr to use
> enums
> and make it cls compliant, I hope I've unwound all those changes for
> this
> version. If you get an error using the C# token classes with antlr 272,
> please let me know : ).
>
> The one thing I haven't been albe to get working is verbatim
> identifiers (it
> is obscure - the ones where you can say @keyword for an identifier).
> The
> verbatim strings are working though (the unescaped strings -
> @"abc/def\ghi"). It is one or the other so far... I've tired in both
> the
> lexer and the parser - the problem is you can have:
>
> string_literal:
> @"string" // unescaped string
> "hello" // normal string
>
> identifier:
> @class // identifier - must be keyword
> ident // identifier
>
> It seems it should be easy, but the way it lines up all the slots one
> by one
> keeps biting me.
>
> Other than that, it should parse everything except for unsafe code,
> and the
> #if preprocessor stuff (next up). It is pretty slow on large large
> files
> (like 20k lines of the antlr output), but reasonable on less than a few
> thousand lines. The grammar is at:
>
> http://www.debreuil.com/CSharp/CSgrammar.html
>
> and the cs files, and a .Net executable (just drag cs files into
> CSharp.exe)
> are at:
>
> http://www.debreuil.com/CSharp/CSharp.zip
>
> I haven't been able to break it for a few hours, but I'm sure there are
> still little things in there. Also, the tree is still inserting quite
> a few
> superfluous nodes, and is a bit strange anyway. Next step I'll move
> that to
> a (walkable) nested object structure, shouldn't take long...
>
> Well, back to Antlr'ing... Cool tool, gotta be (re)said!
>
> Cheers,
> robin
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
--
Professor Comp. Sci., University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
Cofounder, http://www.knowspam.net enjoy email again!
Cofounder, http://www.peerscope.com pure link sharing
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list