cucapra / packet-scheduling

MIT License
3 stars 0 forks source link

Interpreter for DSL #37

Closed csziklai closed 4 months ago

csziklai commented 4 months ago

This PR implements an interpreter that takes a parsed program and checks for well-formedness. It includes a test suite that tests the programs under dsl/progs, including four new programs added that violate well_formedness. The tests include pretty printers that show the diff if a test case fails. The interpreter checks for essentially two things that define well-formedness:

  1. Only declared classes are being referenced. See undeclared_classes.sched for an example of a program that violates this condition.
  2. Only variables that have been assigned a value can be referenced. See unbound_var.sched for an example of a violation.

To run the test suite, cd to dsl_lang, then cd bin. Run

dune build main.exe

Then

dune exec ./main.exe

All 16 tests should pass.