The Definitive ANTLR 4 Reference

2022/2/15 6:13:49

本文主要是介绍The Definitive ANTLR 4 Reference,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

原文:https://github.com/joaoBordalo/feup-COMP/blob/master/The Definitive ANTLR 4 Reference.pdf

ANTLR V4介绍

  • 新的解析技术:Adaptive LL() or ALL()
  • 简化对expression的语法表达
  • 自动将左递归规则重写为等价的非左递归规则
  • parse-tree walker: listener and visitor pattern
  • 相比v3的一些重要改进:
    • embedding actions作为高级应用,更推荐Listern和Visitor
    • 不需要设计tree grammer,使用自动生成的parse tree and tree walker
    • ALL() better than LL()

ANTLR v4 is the result of a minor detour (twenty-five years) I took in graduate
school. I guess I’m going to have to change my motto slightly.
Why program by hand in five days what you can spend twenty-five years of your
life automating?
ANTLR v4 is exactly what I want in a parser generator, so I can finally get
back to the problem I was originally trying to solve in the 1980s. Now, if I
could just remember what that was.

Chapter 1. Meet ANTLR

  • StringTemplate Engine: https://www.stringtemplate.org/about.html

Chapter 2. The Big Picture

  • Language的定义:a language is a set of valid sentences, a sentence is made up of phrases, and a phrase is made up of subphrases and vocabulary symbols
  • Interpreter的定义:计算或者执行sentences的程序
  • Translator的定义:


这篇关于The Definitive ANTLR 4 Reference的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程