Skip to content

selaselah/antlr-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

antlr-demo

下载并设置

wget https://www.antlr.org/download/antlr-4.8-complete.jar
mv antlr-4.8-complete.jar lib/

设置

source antlr.rc

Hello

cd hello/
antlr4 Hello.g  # generate Hello*.java
javac Hello*.java

使用 grun(要额外输入要解析的文本)

grun Hello s -tokens   # 输出 token
grun Hello s -tree     # 输出 文本树
grun Hello s -gui      # 输出 图形树

基本概念

graph LR
  CharStream --Lexer--> Token
  Token --Parser--> ParseTree
Loading

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published