serafim/calc
Composer 安装命令:
composer require serafim/calc
包简介
README 文档
README
Why?
This repository is designed as an example of how you can implement a calculator based on abstract syntax tree generated by the LL(k) recurrence recursive descent parser.
As a grammar used the basic implementation with operators associativity, and not vulnerable to left recursion:
{
tokens = [
T_FLOAT = "regexp:\d+\.\d+"
T_INT = "regexp:\d+"
]
}
<expr> ::= <addition> | <subtraction> | <term>
<term> ::= <multiplication> | <division> | <factor>
<factor> ::= "(" <expr> ")" | <value>
<subtraction> ::= <term> "-" <expr>
<addition> ::= <term> "+" <expr>
<multiplication> ::= <factor> "*" <term>
<division> ::= <factor> ("/" | "÷") <term>
<value> ::= T_FLOAT | T_INT
Example
Command Line Interface
$ php ./bin/cc run
Usage
Global:
$ composer global require serafim/calc $ cc run
Local:
$ composer require serafim/calc $ ./vendor/bin/cc run
统计信息
- 总下载量: 24
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 16
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-08-16

