develooper Front page | perl.perl6.internals | Postings from September 2001

Re: tclc

Thread Previous | Thread Next
From:
Pat Eyler
Date:
September 28, 2001 10:01
Subject:
Re: tclc
Message ID:
1001696138.1791.28.camel@pate.egenera.com
On Fri, 2001-09-28 at 12:31, Will Coleda wrote:
> Due to a bad case of congenital insanity, I have developed a barely
> functional tcl to pasm compiler. 

Okay, I'll step up now too.  I'm working on a ruby-like language that
compiles to pasm.  At this point, it will handle integer math and
comparison, setting of variables (int and string), and printing.  The
compiler is written in ruby and emits assembleable pasm.

helloWorld.rabbit
==========
var1 = "hello "
var2 = "world"
print var1
puts var2


helloWorld.pasm
==========
          set S0, "hello "
          set S1, "world"
          print S0
          print S1
          print "\n"
          end


I'm working on implementing branching and looping, and then will do
floats (should be pretty much a clone of the int stuff)


-pate

> 
> All of the parsing is currently done in perl (not parrot), so it can
> only do a single pass, though it does deal with all of tcl's quoting and
> word-grouping behavior.
> 
> I think the current parrot strings ops will allow me to move nearly all
> of this into the parrot assembler (which is good, because otherwise
> "eval" will never work). I thought perl5 would be an easier initial
> target, however.
> 
> I've only bothered to implement two of the core commands: "set" and
> "puts".
> 
> Before I add much of anything else, I need to implement expressions,
> which means I'm going to have to deal with numbers... which, without
> PMCs, is going to require some kind of variable typing. I suspect I'll
> just cheat and say that S_FOO is a valid STRING name, and that I_FOO is
> a valid integer.
> 
> I've neglected to attach tclc (and the various modules) so as to avoid
> infecting anyone else. I'd be happy to provide a copy on request,
> however.
> 
> Thanks for the interesting thought experiment. ^_^
> 
> (I tried to attach test.tcl and test.pasm, but my lovely MUA is not
> cooperating. Here there are inline)
> 
> 
> [wjc@volvo little_languages]$ cat test.tcl
> #
> # Exercise the various substitution and quoting modes
> #
> #
> 
> set a "St\[ring Parsing"
> puts -nonewline "[set a]XX[set a]"
> puts " "
> puts [set a] 
> 
> # Command substituion
> 
> set b "[set a] stuff\n" ;
> 
> puts $b
> 
> set a {
>   set b {
>     set c
>   }
>   set d
> }
> 
> puts $a
> #
> # Exercise the various substitution and quoting modes
> #
> #
> set S2, "St\[ring Parsing"
> print S2
> print "  "
> print S2
> print "\n"
> print S2
> print "\n"
> # Command substituion
> set S3, ""
> concat S3, S2
> set S1, " stuff\n"
> concat S3, S1
> print S3
> print "\n"
> set S2, "\n  set b {\n    set c\n  }\n  set d\n"
> print S2
> print "\n"
> end
> 



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About