L1VM - variable type safety

Ich fügte Variabeln Typprüfungen in Brackets ein um die Sicherheit zu erhöhen.
Beim Compiler gibt es jetzt eine Fehlermeldung wenn man einer Array Variablen zuviele Konstanten zuweist.
Und es wird erkannt wenn man einer Variablen mit geringerer Genauigkeit Variablen mit einer höheren Genauigkeit zuweist:

I added variable type checks into Brackets to increase security.
The compiler reports now an error if you assign too much constants to an array variable.
And it will be detected if you assign a variable with more precision to a less precision one:

// vartypes-test.l1com
//
#include <intr.l1h>
(main func)
    (set int64 1 zero 0)
    (set int64 1 x 23)
    (set int64 1 y 42)
    (set int32 1 a 0)
    {a = (x * y)}
    ((x y *) a =)
    (cast y a =)
    print_i (a)
    print_n
    exit (zero)
(funcend)

Der Compiler gibt folgenden Fehler aus:

The compiler prints the following error:

$ ./build.sh prog/vartypes-test
error: line 8: expression assigns to target of lower precision!
error: line: 8 can't parse part in { }
>     {a = (x * y)

error: line 9: expression assigns to target of lower precision!
>     ((x y *) a =)


cast: line 10: cast to lower precision variable!
code lines compiled: 12
ERRORS! can't read source file!
[!] out

build failed: 

Es wird einer int32 Variable int64 Werte zugewiesen, was jetzt illegal ist!

Here an int64 variable is assigned to an int32 variable, now illegal!

(cast y a =)

Das ist ein Typcast von int64 auf int32! Es wird eine Meldung ausgegeben:

This is a type cast from int64 to int32! You will get a message:

cast: line 10: cast to lower precision variable!


Hier ist ein if Code Beispiel:

Here is an if statement code example:

// hello-math-3.l1com - Brackets - Hello world
//
//
(main func)
    (set int64 1 zero 0)
    (set double 1 xd 23.0)
    (set double 1 yd 42.0)
    (set double 1 zd 0.0)
    (set double 1 zerod 0.0)
    (set int64 1 f 0)
    (set string s messagestr "xd < yd and xd > 0")
    ((((xd yd <d)(xd zerod >d) &&) f =) f if)
        (6 messagestr 0 0  intr0)
        (7 0 0 0 intr0)
    (endif)
    (255 zero 0 0 intr0)
(funcend)

Das Compiler Skript zeigt die folgende Ausagbe:

The compiler script prints the following output:

$ l1com prog/hello-math-3.l1com

found if like cast: line 12
code lines compiled: 14
[✔] prog/hello-math-3 compiled
assembler args: ' '
assembling file: 'prog/hello-math-3'
codesize: 193 bytes
datasize: 475 bytes
filesize: 748 bytes
[✔] prog/hello-math-3 assembled

Es wird ein if Cast gefunden. Die Variable “f” wird auf eins gesetzt wenn die beiden Fließkommazahlen Vergleiche wahr sind.

So there is a if statement cast detected. There the variable “f” will be set to one if the two double floating point number comparisons are true.
Here is the program run output:

$ l1vm prog/hello-math-3 -q
xd < yd and xd > 0