COS301-HW4
Calculator Language to Jcoco Assembler
Nicholas Pease
Contents
/hacky-solution - Alternate Solution which Requires Python 3.2.6 and makes use of the Jcoco disassembler (Included as I thought it was interesting) /hacky-solution/calc1.py - Calc.py file for hacky solution (DO NOT GRADE, INCLUDED AS IT WAS INTERESTING TO ME) /hacky-solution/disassembler.py - Python to Jcoco disassembler
calc.py - Python compiler for calculator language to Jcoco. For use see below
Usage
Feed lines of the calculator language in via the standard input. The compiler will listen for the EOF signal (CTRL+D) and then generate jcoco code to the standard output.
Valid operations are (+,-,/,//,*,**,%), unary minus (-num), assignments (=)
To feed in a file in linux and execute output in Jcoco: cat filename | python3 calc.py > tester.casm && ./coco tester.casm
Jcoco also requires Java runtime to be installed, and the jcoco binaries downloaded