Skip to content
/ sstalc Public

A compiler/typechecker for STAL (Stack-Based Typed Assembly Language).

Notifications You must be signed in to change notification settings

zhaoyig/sstalc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

To parse from file:

dune utop src, then Interp.Main.parse_file "path/to/file";;. Path is relative to stalc folder.

To compile a file

dune build
dune exec -- stalc test/factorial.stal -o test/factorial.asm

To run .asm file on MacOS

nasm -f macho64 factorial.asm
ld -macosx_version_min 12.6.0 -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -lSystem -o factorial factorial.o
./factorial

To run tests

dune runtest

Note:

  • malloc will overwrite rax
  • substituion is not capture avoiding, name your type variables carefully

Syntax related

  • for polymorphic type instantiation, for words use square brackets, e.g. jmp _fact[nil], for operands use normal brackets.

TODO:

  • Use bdwgc for malloc
  • Check if Bop is buggy when the registers are the same
  • hval
  • stack equality, correctness? (is serialization correct?)
  • forall type free variables?
  • avoid captures

About

A compiler/typechecker for STAL (Stack-Based Typed Assembly Language).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published