ANTLR
- A set of language translation tools (formerly PCCTS).
- It is one of the "Compiler Construction Tool for Programming languages".
- Includes scanner/parser generators for C, C++, and Java.
- Terence Parr is the maniac behind ANTLR and has been working on language tools since 1989. He is a professor of computer science at the University of San Francisco.
- ANTLR(ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files.
- It's widely used to build languages, tools, and frameworks.
- From a grammar, ANTLR generates a parser that can build and walk parse trees.
Example
grammer Expr;
prog : (expr NEWLINE)*;
expr : expr('*'|'/')
expr
|
expr('+'|'-')
expr |
int
|
'('expr')' ;
NEWLINE : [\r\n]+;
int : [0-9]+;
Compile : $ javac Expr.java
prog : (expr NEWLINE)*;
expr : expr('*'|'/')
expr
expr('+'|'-')
expr |
NEWLINE : [\r\n]+;
int : [0-9]+;
Run : $ grun expr prog -gui 100+2*34
No comments:
Post a Comment