darius / toy-compiler

A compiler for a toy language, in Standard ML

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This is supposed to be a compiler from a toy programming language to
MIPS assembly code.  (I never ran the output on an actual MIPS
computer, though, just in simulation via an alternate backend
generating C code.)  I wrote it in 1997 to work out design ideas
mainly from Kelsey's ``A Correspondence between Continuation Passing
Style and Static Single Assignment Form'', Appel's _Compiling With
Continuations_, and Kelsey and Hudak's ``Realistic compilation by
program transformation''.

ast.sml gives the abstract syntax of the source language.
main.sml ties the compiler passes together.
mips-sim.sml is the aforementioned backend, to go with runtime/ C code.

I forget how to build it, except I used CM with SML/NJ, plus a parser
generator, I think one called MLLex/MLYacc. (But the generated parser
is also checked in to this repo, apparently.)

To run tests: cd tests/ && make okay

I've barely glanced over these files now in 2022; I hope there's
nothing too embarrassing.

Darius Bacon

About

A compiler for a toy language, in Standard ML

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Standard ML 66.2%Language:Component Pascal 13.4%Language:C 8.0%Language:Assembly 7.9%Language:Scheme 1.9%Language:Lex 1.8%Language:Makefile 0.6%Language:Shell 0.2%