dcsimg
Non-determinism in lexer
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Suresh_Easwar
Posted On:   Friday, December 13, 2002 06:14 PM

Why is the following lexer grammar ambiguous for k = 2 but not for k = 3? . . . MultilineComment : ""/*"" ( { LA(2) != '/' }? '*' | ' ' { newline(); } | "" "" { newline(); } | ~( '*' | ' ' | ' ') )* ""*/"" { $setType(Token.SKIP); } ; . . . ANTLR Parser Generator Version 2.7.1 1989-2000 jGuru.com com/qsi/parser/oracle912/oracle912.g:59: warning: lexical nondeterminism upon com/qs   More>>


Why is the following lexer grammar ambiguous for k = 2 but not for k = 3?

			
.
.
.
MultilineComment
: ""/*""
( { LA(2) != '/' }? '*'
| '
' { newline(); }
| ""
"" { newline(); }
| ~( '*' | '
' | '
')
)*
""*/"" { $setType(Token.SKIP); }
;
.
.
.

ANTLR Parser Generator Version 2.7.1 1989-2000 jGuru.com
com/qsi/parser/oracle912/oracle912.g:59: warning: lexical nondeterminism upon
com/qsi/parser/oracle912/oracle912.g:59: k==1:'*'
com/qsi/parser/oracle912/oracle912.g:59: k==2:'/'
com/qsi/parser/oracle912/oracle912.g:59: between alt 1 and exit branch of block
   <<Less
About | Sitemap | Contact