Created
December 22, 2011 15:07
-
-
Save kakkun61/1510617 to your computer and use it in GitHub Desktop.
Java Advent Calendar 2011 code 6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PARSER_BEGIN (Parser) | |
public class Parser { | |
} | |
PARSER_END (Parser) | |
SKIP: { | |
" " | |
} | |
TOKEN: { | |
<INTEGER: (["0"-"9"])+> | |
| <NL: "\r\n" | "\n" | "\r"> | |
} | |
void List(): { | |
int val; | |
} { | |
val = Expression() <NL> { | |
System.out.println(val); | |
} | |
} | |
int Expression(): { | |
Token token; | |
} { | |
token = <INTEGER> { | |
return Integer.parseInt(token.image); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment