Skip to content

Project for learning how to make interpreters (Concepts of Programming Languages)

Notifications You must be signed in to change notification settings

dlowrey/bool-interpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 

Repository files navigation

Boolean Interpreter

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

Run

  1. git clone https://github.com/dlowrey/bool-interpreter.git
  2. cd bool-interpreter/BooleanInterpreter
  3. python interpreter.py or pythonN interpreter.py where N is your python version if you have it set up that way.

Language

<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>)

Syntax:

Valid Tokens:

  • . (EOF)
  • (whitespace)
  • ^ (and)
  • v (or)
  • -> (implies)
  • ~ (not)
  • T (true)
  • F (false)
  • ( (left parenthesis)
  • ) (right parenthesis)
  • error otherwise

Examples:

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.

About

Project for learning how to make interpreters (Concepts of Programming Languages)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages