[antlr-interest] How to migrate from ANTLR V2 to V3

vasanthi a vasanthi.ak at gmail.com
Tue Jun 2 03:47:12 PDT 2009


Hi All

I have a source code that is written in ANTLR V2. I want to migrate the code
from V2 to V3.
What are the procedures that needs to be followed? What all I  need to
install?

Currently I am facing a problem with Comments.

When I instrument the code which is having comment , after instrumentation
all the comments are getting
removed.


I want to retain the comments after instrumentation of code.

The below is the grammar I am using in ANTLR v2.


// Single-line comments

SL_COMMENT

: "//" (~('\r'|'\n'))* {$setType(Token.SKIP);}

;





// multiple-line comments

ML_COMMENT

: "/*"

(options {generateAmbigWarnings=false;}:

{ LA(2)!='/' }? '*'

| EndOfLine

| ~('*'|'\n'|'\r')

)*

"*/" {$setType(Token.SKIP);}

;





if I use $Channel= HIDDEN instead of {$setType(Token.SKIP);}

it throws a error "Undefined token $"

I think this error could be because of using ANTLR 2



It would be nicer if the solution is in ANTLR 2 itslef.

I want to know how to retain comments in the instrumented code.



Vasanthi.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090602/40f5fd04/attachment.html 


More information about the antlr-interest mailing list