For a -very- primitive Scheme -> Parrot compiler, see

 http://216.254.0.2/~jgoff/Files/scheme.tar.gz

This is purely proof-of-concept for a much more sophisticated
implementation. The current tarball has support for only integer math
operators and predicates, although there is minimal support for data
types and data type tracing. I'm hoping to use this weekend to add
support for real data types and possibly strings.

Test files (using the provided version of Test::More) are in the t/
directory, and can be run by typing 'make test' at the command line. The
test suite currently covers all of the currently-working expressions.
Simple variables will hopefully be added over the weekend alongside data
type tracing.

My motivation for this little project was to prove that more than one
class of languages could easily be targeted to the same set of assembly
instructions. LISP and its cousin, Scheme, has a regular syntax, and it
was relatively simple to tokenize, unlike Perl or cousins.

On a more practical note I'm experimenting with register operations
which cross stack boundaries. This would allow compilers to not worry
about situations when all 32 I/N/S/P registers are in use, and a
temporary is needed. For instance:

<reserve I0-I31> # Pretty extreme, but possible with a tight compiler.
mark
pushi
set I1,5
mul I0,I1,I31 # I31 retains its value from the stack-preserving 'push'
operation
copy_mark I0,I31 # Copy from I0 to I31 at the marked register frame
popi # The stack is now back to where it was, with I31 multiplied by 5

Of course, this requires implementation of the 'mark' instruction.
(Though it can be emulated by temporarily hardwiring the copy_mark
operator to use the register frame just above the current frame)

If my explanation isn't clear, then please ask for clarification. I keep
hoping that there's an answer to my situation that doesn't involve new
instructions, or can be implemented without a great deal of overhead.

-Jeff Goff
<[EMAIL PROTECTED]>

Reply via email to