diprism / perpl

The PERPL Compiler
MIT License
10 stars 5 forks source link

Better error messages #14

Closed davidweichiang closed 3 years ago

davidweichiang commented 3 years ago

Right now, I get

$ ./compiler.exe < code/example12.ppl
Parse error
colin-mcd commented 3 years ago

I'll work on more helpful parse error messages, but for a quick answer to this particular file, there are a few causes:

  1. define odd = ... needs to be define odd : Bool -> Bool = ...
  2. There is no if-then-else statement right now; instead use case: case sample_p of false -> not q | true -> odd (odd q)
  3. This is actually just a type error, but you will also need to define what Bool and not are because they aren't built in. Probably just write data Bool = false | true; and define not : Bool -> Bool = \ a : Bool. case a of false -> true | true -> false;.
davidweichiang commented 3 years ago

Ah, thanks. I modified code/example12.ppl and it works now. But the other two new examples in code/ still get Parse error.