I have a 800-line ANTLR 3 grammar that works fine.  I use an editor  
TextMate to edit it.  This works, but TextMate doesn't know how to  
syntax-highlight the code.  TextMate can be trained to do so, but it's  
hard because ANTLR grammar files contain 2 mixed languages, ANTLR and  
Java.  Obviously I can live with unhighlighted code, but I notice that  
when editing several files at once with TextMate, I see some Java code  
highlighted and some not.

I know I can use ANTLRWorks, but I'd rather use a single editing tool  
than juggle multiple GUIs.  Besides, my grammar is fairly static -  
it's the interspersed Java that changes.

A while back, someone on this mailing list suggested that my grammar  
might benefit if I were to move all the Java into a separate .java  
file.  In other words, replace each occurrence of a block of Java with  
a simple Java function call, so that the bulk of the Java would move  
to the .java file.

This seems like an interesting idea.

Pros:
It would make the grammar more compact, so it would be much easier to  
"see" the grammar rules and StringTemplate invocations.
I'd be more tempted to train TextMate to highlight ANTLR grammars.
It would keep most of the Java in a .java file, where it can be  
highlighted correctly.

Cons:
It would be yet another source file.
It would add a bunch of argument passing.
It wouldn't deal with grammar rules that contain Java fragments, such  
as this, from my grammar:

methodDeclaration
     : dataType methodName LPAREN  
(methodParameterList{mpexists=true;})? RPAREN SEMICOLON


Anyway, does this idea have any merit?

-- Pete



List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/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