Skip to content

Golang to WebAssembly compiler written in OCaml

Notifications You must be signed in to change notification settings

cheukchuen/go-to-wasm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go to WebAssembly Compiler

Basically a compiler, written in OCaml, that transpiles from GoLite (subset of Go) to WebAssembly text format (S-expressions).

Instructions

Build:

  • To build the compiler, go to src/ and execute make. (dependencies: menhir, ocamlfind, ocamlbuild)

Clean:

  • To remove the compiler build directory and other files, go to src/ and execute make clean.

Run:

  • To run the compiler for a program, execute <path_to_src>/main.native [lex|parse|weed|pretty|type|compile] [-dumpsymtab] [-pptype] [-h] [-v] <path_to_programs>/foo/bar.go.
  • If no action is provided, it'll default to code generation in this milestone.
  • If additional flags are set, the output file will be in the same directory as the input file.

Test:

  • Go to programs/ and execute dotests.sh [lex|parse|weed|pretty|type].