I was able to use the Java.g grammar to create a syntax highlighter in a
skeleton Visual Studio language service in about 45 minutes today. It
was very easy to use from the clean work on it! :)

The lexer goes from 19000+ to just over 11000 lines, and codegen time is
cut in half or better if you do the following:

The last alt in each of IdentifierStart and IdentifierPart prevent those
rules from evaluating as sets. Change the IDENTIFIER rule to this:

IDENTIFIER
        :       (IdentifierStart | IdentifierStart2) (IdentifierPart |
IdentifierPart2)*
        ;

And move the last lines of IdentifierStart and IdentifierPart to the new
fragment rules IdentifierStart2 and IdentifierPart2 (they should no
longer be alts in IdentifierStart and IdentifierPart):

fragment
IdentifierStart2
        :       ('\ud800'..'\udbff') ('\udc00'..'\udfff')
        ;

fragment
IdentifierPart2
        :       ('\ud800'..'\udbff') ('\udc00'..'\udfff')
        ;

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Terence Parr
Sent: Monday, November 10, 2008 2:45 PM
To: antlr-interest Interest
Subject: [antlr-interest] ANTLR-based Java grammar for javac compiler

http://openjdk.java.net/projects/compiler-grammar/

Direct link to the grammar:

http://openjdk.java.net/projects/compiler-grammar/antlrworks/Java.g

USF MSCS student Yang Jiang built this as an intern for Sun.

Terence

List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-addr
ess


List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to