Skip to content

Latest commit

 

History

History
105 lines (94 loc) · 4.59 KB

Readme.md

File metadata and controls

105 lines (94 loc) · 4.59 KB

Ocamlhi - Caml-like functional language interpreter written in Haskell

Useful files

Modified language grammar
Tests' description and known bugs

Language modifications

  1. Function calls should be Ocaml-like. [Work in progress.]
  2. Expressions with infix operators always have to be enclosed in brackets.
  3. Static-typing with type signatures.
  4. Static bindings.
  5. #enable statements which modify the behaviour of the interpreter.
  6. C++ style garbage collector based on shared pointers.

Naming Convention (Source)

  1. eval* functions evaluate expressions.
  2. apply* functions apply functions to elements and returns the result.
  3. trans* functions modify the environment.
  4. to*From* functions perform casting.
  5. type* functions are connected with type evaluation.
  6. trace* functions print to stdout.
  7. make* functions generate code.
  8. fv* functions are connected with static binding.
  9. set* functions modify the scope properties.
  10. mem* functions are responsible for memory management.

Build docker image

    make build_docker

Dealing with containers

If you want to start the container and you have not already created it use:

    make run_docker

Otherwise attach to the container:

    make start_docker

If you want to delete the container run:

    docker container rm ocamlhi

Build

    make build

Test

    make test
    python3 unittests.py [--print_failed]
    ./ocamlhi tests/good/01_Constants.ml
    ./ocamlhi -s tests/good/99_Tree.ml # TODO(?)

Style

    ./test_style.sh
    make test_style

Debugging

Use printing functions inside the code:

    pushToOstream "Checkpoint"
    traceEnvironment;

Alternatively, you can change defaultFlags in Flags.hs.

Grammar changes

If you need to update the grammar you can:

  1. Modify the ocaml.fc file.
  2. Run make bnfc
  3. Resolve changes manually.

Issues

If the output is "Killed" you probably have exceeded timeout (tests, timeout = 1s).
You may try to run the test manually.

References

Referenced papers