identifier token keyword antlr parser

Posted by batman_for on Stack Overflow See other posts from Stack Overflow or by batman_for
Published on 2010-04-27T16:40:46Z Indexed on 2010/04/27 16:43 UTC
Read the original article Hit count: 288

Filed under:
|
|
|
|

How to handle the case where the token 'for' is used in two different situations in the language to parse? Such as statement and as a "parameter" as the following example:

echo for print example
for i in {0..10..2}
  do
     echo "Welcome $i times"
 done

Output:

for print example
Welcome 0 times
Welcome 2 times
Welcome 4 times
Welcome 6 times
Welcome 8 times
Welcome 10 times

Thanks.

© Stack Overflow or respective owner

Related posts about antlr

Related posts about parser