This projects aims to receive an well formed formula of the proposional logic and, after some steps, convert it into equivalent pcode instructions.
- Catch the logical expression from input;
- Running it in a pushdown automata;
- Use result of step 2 to build a binary tree;
- Run postorder transversal at btree to build reverse polish notation;
- Convert RPN into valid Pcode instructions;
- Run pcode and then generate output file;
E -> 0 | 1 | p | q | !E | (EAEB
A -> & | | | : | -
B -> )
Note: Your program do not assign value to p and q, although accept it.
Conective | Code | Semantic |
---|---|---|
^ | & | AND |
v | | | OR |
¬ | ! | NOT |
-> | : | IMPLICATION |
<-> | - | BICONDITIONAL |
F | 0 | FALSE |
T | 1 | TRUE |
gcc -o teste ada2asa.c pcode.c rpn2pci.c btree2rpn.c pushdown.c main.c
./teste "expression"
- For successful conversion the user must provide a balanced logical expression.