欢迎大家赞助一杯啤酒🍺 我们准备了下酒菜:Formal mathematics/Isabelle/ML, Formal verification/Coq/ACL2, C++/F#/Lisp
ANTLR
来自开放百科 - 灰狐
(版本间的差异)
小 |
小 (→语言) |
||
(未显示1个用户的5个中间版本) | |||
第1行: | 第1行: | ||
{{SeeWikipedia}} | {{SeeWikipedia}} | ||
− | |||
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. | 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 | ||
+ | |||
+ | ==语言== | ||
+ | *[https://github.com/apache/groovy/tree/master/src/antlr Groovy]词法分析、语法分析 [[Groovy]] [https://github.com/apache/groovy/blob/master/src/main/antlr2/org/codehaus/groovy/antlr/groovy.g Main程序] | ||
+ | |||
+ | ==项目== | ||
+ | |||
+ | ==图集== | ||
+ | <gallery> | ||
+ | image:antlr-editor.jpg|Editor | ||
+ | image:antlr-parse-tree-insepector.png|语法分析树 | ||
+ | </gallery> | ||
==链接== | ==链接== |
2018年5月4日 (五) 07:00的最后版本
您可以在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
[编辑] 语言
[编辑] 项目
[编辑] 图集
[编辑] 链接
分享您的观点