Very cool. Will have to look into it soon.
Are you still contemplating making the whole thing compiled?

> Tcl's [expr] command now compiles expressions to PIR (before, it would
create an AST that it would then interpret when you wanted the value.).
Note: the language itself is still interpreted, this is only one command
in the language.
>
> E.g: given a command like
>
> while {$a < 10} {incr $a}
>
> Originally, the while would parse the $a < 10 expression once, then
interpret it (walk through the AST and generate a value) each time. Now,
it compiles the expression to PIR once:
>
> .pragma n_operators 1
> .sub blah @ANON
> .local pmc read
> read=find_global "_Tcl", "__read"
> .local pmc number
> number=find_global "_Tcl", "__number"
> $P0 = read("a")
> $P0 = number($P0)
> $P1 = new .TclInt
> $P1=10
> $I2 = islt $P0, $P1
> $P2 = new .TclInt
> $P2= $I2
> .return ($P2)
> .end
>
> and then just invokes it when it wants the current value.
>
>
>



Reply via email to