Skip to content

psykora/ExpressionCalculator

Repository files navigation

ExpressionCalculator

This is and experiment to write a simple LL(1) parser without parsing table, but with set of rules implemented using std::variant and visitor concept.

The set of terminals are defined in Lexer.h and the simplistic lexer is implemented in Lexer.cpp The rules for LL(1) parser are defined in Parser.cpp

EBNF Grammar is as below:

     E -> T {op1 T}*
     T -> F {op2 F}*
     F -> number | op1 F | '(' E ')'

This is further converted to the following BNF LL(1) grammar

     E  -> T E'
     E' -> $ | bin_op1 T E'
     T  -> F T'
     T' -> $ | bin_op2 F T'
     F  -> number | bin_op1 F | '(' E ')'

References

Status

Branch / Compiler MSVC 2017
master Build status

About

Naive implementation of LL(1) parser and AST builder using std::variant (C++17)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages