Giter Site home page Giter Site logo

ll-parser's Introduction

LL-Parser 基于LL分析的语法分析器

程序功能

  • 识别文法
  • 提取左公因式
  • 消除直接左递归
  • 构建 FIRSTFOLLOW 集合
  • 构建LL预测分析表
  • 通过LL(1)分析法,分析句子
  • 简易词法分析(仅特殊识别idnum

运行环境

  • 支持 C++11 标准的C++编译器

使用方法

由于程序不支持 Unicode 所以全程使用符号 ` 代表符号 ε

命令

parser grammar.txt lexer.txt

文法

(数字)四则运算表达式:句子示例 5*6+7

E -> E+T | E-T | T
T -> T*F | T/F | F 
F -> (E) | num

符号加乘表达式:句子示例 a+b*c

E -> TE' 
E' -> +TE' | ` 
T -> FT'
T' -> *FT' | ` 
F -> (E) | id

(Unknown):句子示例 (a,(b,(2)),(c))

S -> E
E -> A | B
A -> num | id
B -> (L)
L -> E,L | E

待办清单

  • 通用输入输出(文法、句子参数化)
  • 消除间接左递归
  • 优化错误处理
  • Unicode支持

ll-parser's People

Contributors

lin594 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.