joristt / Hanus

A much more powerful version of the reversible language Janus, built in Haskell
8 stars 0 forks source link

Semantic checking. #43

Closed omelkonian closed 6 years ago

omelkonian commented 6 years ago

Closes #43 Will be integrated in the whole process by #38.

CHECKS

  1. lhs not on rhs
  2. main procedure

NOTE Does not currently support some expression types on the rhs (e.g. let/where/cases/do).

jorisburgers commented 6 years ago

@omelkonian I don't see the code that verifies that there is exactly one procedure called main, maybe you should add that check as well.

omelkonian commented 6 years ago

@all If you think of any other helpful static checks, let me know.

joristt commented 6 years ago

I haven't looked at any of the code you wrote so I don't know if you've already accounted for this, but FYI: a haskell method called "run" is generated as well during compile time (it calls "main" and returns a tuple with the final values of all global variables, so that the user can see them).

EDIT: I actually don't think you have to check this after all, but I'm not sure yet. @casvdrest you wrote that code. We can just use newName to always generate a run function with a different name right?

omelkonian commented 6 years ago

@joristt And what would be the static check then? That the user does not define a procedure named run?

omelkonian commented 6 years ago

Maybe it's better to ignore (for now) the evaluator-dependent checks that we can perform (e.g. checking that the user does not call our internally-generated Haskell declarations in rhs expressions), focusing on static checks from the Janus-only side.

omelkonian commented 6 years ago

@jorisburgers Should we check that main has no parameters?

jorisburgers commented 6 years ago

@omelkonian The functions qLookupName and lookupValueName should be able to inspect the RHS for the variables used. In that case, we would support all possible haskell and the code would be much shorter.

omelkonian commented 6 years ago

@jorisburgers I cannot make lookupValueName to work, since it acts inside a splice, but it is impossible to splice the Exp that has been parsed. Am I missing something?

jorisburgers commented 6 years ago

@omelkonian I tried getting it to work, but I couldn't get it to work the way we want either. Let's stay with your implementation.

omelkonian commented 6 years ago

Rebased.