L1VM - math expressions
L1VM - math expressions
Ich behob Fehler im Compiler. Man kann jetzt in Brackets komplexe Matheausdrücke verwenden. Der RPN Parserteil hatte einen Bug, der jetzt behoben ist!
I fixed some errors in the compiler. Now it is possible to use complex math expressions in Brackets. In the RPN parser there was a bug, which is now fixed!
NEW
Ich fügte alle C Mathefunktionen zu dem Mathemodul von Brackets hinzu!.
I added all C math functions to the math module of Brackets! The new version of L1VM is now 1.1.0.
Here is the “hello-math.l1com” example:
// hello-math.l1com - Brackets - Hello world
//
// RPN math and infix math expressions
//
(main func)
(set int64 1 zero 0)
(set int64 1 x 23)
(set int64 1 y 42)
(set int64 1 z 13)
(set int64 1 foo 23)
(set int64 1 ret 0)
(set string 13 hello "Hello world!")
// print string
(6 hello 0 0 intr0)
(7 0 0 0 intr0)
// reversed polish notation (RPN):
{ret = x y + z x * *}
(4 ret 0 0 intr0)
(7 0 0 0 intr0)
// RPN:
{ret = x y z + *}
(4 ret 0 0 intr0)
(7 0 0 0 intr0)
// RPN math notation:
{ret = x y + x y * z * x y z * + - -}
(4 ret 0 0 intr0)
(7 0 0 0 intr0)
{ret = x + (y * z) + (x - (y * z) - ((y - z) + (x * y)))}
(4 ret 0 0 intr0)
(7 0 0 0 intr0)
{ret = (((x - y * z) + (z - x + y) - y * z) + z - x + y) + x * y * z}
(4 ret 0 0 intr0)
(7 0 0 0 intr0)
(255 zero 0 0 intr0)
(funcend)
And here is the output:
[stefan@tuxmobile l1vm-2021-06-05-work]$ l1vm prog/hello-math -q
Hello world!
19435
1265
-11924
-949
11553