Skip to content

Latest commit

 

History

History
15 lines (15 loc) · 628 Bytes

File metadata and controls

15 lines (15 loc) · 628 Bytes

Parser

A small Project to explore the Boost::qi::spirit and boost::phoenix parser lib and get into how a simple AST Parser works.
This example implements a small calculator and its syntax as an EBNF.


It's grammer consists of the following EBNF:

EBNF of this Grammar:
      varname = "A" .. "z" , { <alphanumeric> }
      start = (varname, ("=" | "+=" | "-=" | "*=" | "/=") , term) | term
      term = product, ("+" | "-"), term | product
      product = (factor, ("*" | "/" | "^" | "&&" | "||") , product) | (factor)
      factor = group | varname | double-number
      group = "(", term, ")"