U-Code interpreter
- Fully implemented interpreter of U-Code standard
- Has additional calculation of floating point feature. Details are below (due to TTime Language Compiler's feature)
- Fully compatible with TTime Language Compiler
- Support recursive function call
./src/interpreter.py '<UCode source path>' '<result file path>'
- this support 32bit floating point calculation.
- Every floating point value must notated with integer (??? pass and read below).
- according to IEEE 754, floating point value is converted to bit-array. and that bit-array can read as integer in computer.
- this trick is base of floating point support.
32 bit array 11000000010110011001100110011010
is
- usage:
call addFloat
- pop 2 value (a, b) in stack and push a + b.
- usage:
call subFloat
- pop 2 value (a, b) in stack and push a - b.
- usage:
call mulFloat
- pop 2 value (a, b) in stack and push a * b.
- usage:
call divFloat
- pop 2 value (a, b) in stack and push a / b.
- usage:
call divFloat
- pop 2 value (a, b) in stack and push a % b.
- usage:
call divFloat
- pop 1 value (a) in stack and push -a.
- usage:
call F2I
- pop 1 value in stack and push value that converted to integer
- ex: if a is
4.0
(IEEE 754 form01000000100000000000000000000000
), pushed value is4
(100
b)
- usage:
call I2F
- pop 1 value in stack and push value that converted to float
- ex: if a is
4
(100
b), pushed value is4.0
(IEEE 754 form01000000100000000000000000000000
)
- usage:
call writeF
- pop 1 float value and print as float