欢迎大家赞助一杯啤酒🍺 我们准备了下酒菜:Formal mathematics/Isabelle/ML, Formal verification/Coq/ACL2, C++/F#/Lisp
ANTLR
来自开放百科 - 灰狐
(版本间的差异)
小 |
小 (→mac OS) |
||
第14行: | 第14行: | ||
$ alias antlr4='java -jar /usr/local/lib/antlr-4.7.1-complete.jar' | $ alias antlr4='java -jar /usr/local/lib/antlr-4.7.1-complete.jar' | ||
$ alias grun='java org.antlr.v4.gui.TestRig' | $ alias grun='java org.antlr.v4.gui.TestRig' | ||
+ | touch Expr.g4 | ||
+ | grammar Expr; | ||
+ | prog: (expr NEWLINE)* ; | ||
+ | expr: expr ('*'|'/') expr | ||
+ | | expr ('+'|'-') expr | ||
+ | | INT | ||
+ | | '(' expr ')' | ||
+ | ; | ||
+ | NEWLINE : [\r\n]+ ; | ||
+ | INT : [0-9]+ ; | ||
+ | 运行 | ||
+ | $ antlr4 Expr.g4 | ||
+ | $ javac Expr*.java | ||
+ | $ grun Expr prog -gui | ||
+ | 100+2*34 | ||
+ | ^D | ||
==语言== | ==语言== |
2018年5月4日 (五) 06:44的版本
您可以在Wikipedia上了解到此条目的英文信息 ANTLR Thanks, Wikipedia. |
ANTLR, ANother Tool for Language Recognition, is a language tool that provides a framework for constructing recognizers, interpreters, compilers, and translators from grammatical descriptions containing actions in a variety of target languages. ANTLR provides excellent support for tree construction, tree walking, translation, error recovery, and error reporting.
目录 |
简介
功能
指南
mac OS
$ cd /usr/local/lib $ sudo curl -O https://www.antlr.org/download/antlr-4.7.1-complete.jar $ export CLASSPATH=".:/usr/local/lib/antlr-4.7.1-complete.jar:$CLASSPATH" $ alias antlr4='java -jar /usr/local/lib/antlr-4.7.1-complete.jar' $ alias grun='java org.antlr.v4.gui.TestRig'
touch Expr.g4
grammar Expr; prog: (expr NEWLINE)* ; expr: expr ('*'|'/') expr | expr ('+'|'-') expr | INT | '(' expr ')' ; NEWLINE : [\r\n]+ ; INT : [0-9]+ ;
运行
$ antlr4 Expr.g4 $ javac Expr*.java $ grun Expr prog -gui 100+2*34 ^D
语言
项目
图集
链接
分享您的观点