aochagavia / AFP-Ants

1 stars 0 forks source link

Implement checks on Programs #5

Closed aochagavia closed 7 years ago

aochagavia commented 7 years ago

We need to check the following properties (see Language.Fragment.hs at the bottom):

ReinierMaas commented 7 years ago

Create sets.

All gotos target existing labels.

All labels should be used, no dead code.

What is the problem with skipped labels? If we already check for the above

aochagavia commented 7 years ago

"Collect all labels into a set" finds the labels present in the program. The point is that unused labels aren't present in the program.

JorritDorrestijn commented 7 years ago

The no unused labels check is implemented in commit f61be97949e9be24e0c40a6e008cb84ac714f076.

ReinierMaas commented 7 years ago

Unused labels already didn't end up in the source code.

aochagavia commented 7 years ago

@ReinierMaas the checks are performed on the Program data type, before translating it to code.

ReinierMaas commented 7 years ago

Okay, that clears that up. Checked the code this time, with tests!

JorritDorrestijn commented 7 years ago

The no dead check code is implemented in commit c788dc85418c0c9ba7333da1c6593c3da33b2ef5. This led to some code duplication which I've fixed as well.

JorritDorrestijn commented 7 years ago

It looks like all properties are checked now, so I'm closing this issue.