Yes, that's the plan, but the initial implementation isn't going to be a compiler like most people would expect: For example, something like: while {$a < 10} { incr a } while isn't language syntax. it's a command. So, this code would result in creating two PMCs for the args (first arg is {$a <10}, second is {incr a}), and then lookup the while PIR .sub, and invoke it with the two PMC args. Future versions of the compiler will be able to cheat (presuming the while builtin hasn't been overriden) and generate inline-able PIR, which should improve performance.) Regards. On Sep 29, 2005, at 11:21 AM, Amos Robinson wrote: > 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. >> >> >> >> > > > > >Thread Previous | Thread Next