plum-umd / the-838e-compiler

Compiler for CMSC 838E
2 stars 0 forks source link

Prefab structures #6

Open dvanhorn opened 3 years ago

dvanhorn commented 3 years ago

Add support for prefab structures. An instance of a prefab structure can be represented as a heap-allocated structure that consists of a key and an array of field values. The key should be a symbol (so this will depend on #5) and you should implement make-prefab-struct as described in the Racket docs. (This does not need to support other kinds of keys beyond symbols).

After adding run-time support for prefab instances, add prefab struct definitions to set of allowable definitions in a program. A prefab struct definition should bind names for a constructor, predicate, and accessor functions for instances of a prefab.

dvanhorn commented 3 years ago

Any updates on this?

OlasubomiEfuniyi commented 3 years ago

The compiler is done and passing all the tests. This includes tests for "make-prefab-struct" and struct definitions. We just need to add prefab structs to the interpreter.

abrassel commented 3 years ago

Hi, I'm merging onto your feature because I need the extra types for #22 . When I run the tests on your branch I get a single test failure:

raco test: "test/compile.rkt"
raco test: "test/interp.rkt"
match: no matching clause for #f
  context...:
   /usr/share/racket/collects/racket/match/runtime.rkt:24:0: match:error
   /home/alex/Documents/the-838e-compiler/villain/interp.rkt:154:0: interp-env*
   /usr/share/racket/collects/racket/match/compiler.rkt:507:40: f46
   /home/alex/Documents/the-838e-compiler/villain/interp.rkt:154:0: interp-env*
   /usr/share/racket/collects/racket/match/compiler.rkt:507:40: f46
   /usr/share/racket/pkgs/rackunit-lib/rackunit/private/check.rkt:121:16
   body of "/home/alex/Documents/the-838e-compiler/villain/test/interp.rkt"
   /usr/share/racket/pkgs/compiler-lib/compiler/commands/test.rkt:77:2
   body of (submod "/usr/share/racket/pkgs/compiler-lib/compiler/commands/test.rkt" process)
   body of top-level
interp.rkt: raco test: non-zero exit: 1
raco test: (submod "test/test-programs/get-progs.rkt" test)
raco test: "test/test-progs.rkt"
raco test: "test/test-runner.rkt"
1/496 test failures
OlasubomiEfuniyi commented 3 years ago

Yeah, that's because we are still finishing up the interpreter. Maybe just comment out the prefab structure tests for now