Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend assertions to non-integers. #2

Closed
chkl opened this issue Feb 28, 2018 · 2 comments
Closed

Extend assertions to non-integers. #2

chkl opened this issue Feb 28, 2018 · 2 comments

Comments

@chkl
Copy link
Collaborator

chkl commented Feb 28, 2018

We can also use the typechecker in Language.C.Analyzer to use type information.

@chkl
Copy link
Collaborator Author

chkl commented Mar 8, 2018

The typechecker of Language.C checks types but does not store any infomation on the statement/expression level. Currently I can think of only one proper way that requires changes to the language-c module, unfortunately it seems like a lot of work.
1.) Extend the AST annotation type from a single type a to a whole type family. For our compiler class we used this approach that was first described in the "Trees that Grow"(TTG) paper by Najd and Jones(2017).

2.) Add an extra version of the MonadTrav class that changes the return types of its handlers from () to the type of the original fragment, parametrized by the expected output.

3.) Rewrite the Typechecker to use the new MonadTrav'.

Pro: Clean, potential contribution to language-c.
Con: Lot of work, might end up with a unmaintained fork of language-c.

@chkl
Copy link
Collaborator Author

chkl commented Mar 9, 2018

Okay, so there's also SemRep which is a more semantic representation of the AST, whcih fortunately contains type information. Unfortunately there's no way yet to export SemRep back into an AST, as some crucial functions in Language.C.Export have not been implemented yet.

I opened an issue, offering to implement the missing feature in language-c:

visq/language-c#50

@chkl chkl closed this as completed Mar 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant