Project for Concepts of Programming languages. Consists of a Lexical analyzer and an interpeter for boolean expressions.
Information on what a Grammer is can be found here
git clone https://github.com/dlowrey/bool-interpreter.git
cd bool-interpreter/BooleanInterpreter
python interpreter.py
orpythonN interpreter.py
whereN
is your python version if you have it set up that way.
<B> := <IT>.
<IT> := -> <OT><IT_Tail>
:=
<IT_Tail> := -> <OT><IT_Tail>
:=
<OT> := <AT> <OT_TAIL>
<OT_Tail> := v<AT> <OT_Tail>
:=
<AT> := <L><AT_Tail>
<AT_Tail> := ^ <L> <AT_Tail>
:=
<L> := <A>
:= ~<L>
<A> := T
:= F
:= (<IT>)
Valid Tokens:
.
(EOF)^
(and)v
(or)->
(implies)~
(not)T
(true)F
(false)(
(left parenthesis))
(right parenthesis)- error otherwise
Expression | Evaluation |
---|---|
T. |
true |
T v F. |
true |
T -> T. |
true |
~T. |
false |
T -> (T -> (F -> ~T)). |
true |
Any syntactically incorrect expressions will result in an error message and a prompt for another expression.