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.gitcd bool-interpreter/BooleanInterpreterpython interpreter.pyorpythonN interpreter.pywhereNis 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)(whitespace)^(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.