GNU/Linux ◆ rxvt-unicode-256color ◆ zsh 375 views

The LoGic Compiler (lgc) is a compiler for a small language I designed that evaluates logical expressions. Each logical expression is given as a .lgc file, the compiler will output a binary that once ran will draw the truth table of the given logical expression.

The reserved keywords are

  • NOT
  • AND
  • OR
  • NOR
  • NAND
  • XOR

All identifiers are made of lowercase and uppercase characters. The ( and ) are used to define blocks and higher precedence. The two logical conditionals -> and => are equivalent and mean implication and <-> and <=> are equivalent and mean equivalence.

For example given the program NOT(p) OR q <=> (p -> q) the program will output

q p Output 0 0 1 0 1 1 1 0 1 1 1 1