Skip to main content

Crate cas_parse

Crate cas_parse 

Source
Expand description

解析层:plain 文法(与 cas-print 的 plain 输出互为往返,D6 承诺)。

文法(优先级 ^ > 一元 ± > * / > + -^ 右结合,指数可带符号):

expr    := term (('+' | '-') term)*
term    := unary (('*' | '/') unary)*
unary   := ('+' | '-') unary | postfix
postfix := atom ('^' unary)?
atom    := int | float | ident | ident '(' expr (',' expr)* ')' | '(' expr ')'

标识符后随 ( 视为函数应用(参数保持书写次序),否则为符号。 构造经 Context 的规范形入口,解析结果即刻规范化。

Structs§

ParseError
解析错误:pos 为字节偏移。

Functions§

parse