-
Notifications
You must be signed in to change notification settings - Fork 165
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
Make Ulf Norell's define
example work in all backends
#363
Comments
@andreasabel We just hit:
Any pointers to fix? |
I am now working to extend the expression type by typing information, so that the printers can pick the right list constructors. |
Preparing for a refactoring of the TypeChecker to retain more information about the list constructors.
Preparing for an algebraic type `Label` with `instance IsFun Label`.
Show Cat is retained for Hspec, but not used in the main code base.
Typing information is preserved in Exp and the Define pragma. Not used yet in the backends.
- NULL instead of make_[] - make_ListFoo instead of make_(:)
- do not invoke the type checker a second time - 'cons' needed in AbsynDef.java - sanitize Java keywords clashing with definitions
List-cons does not need a type parameter.
This test has a non-linear definition: ``` define inc x = Assign x (EOp (EVar x) Plus (EInt 1)) ; ``` This creates syntax trees that not trees bug DAGs. ``` make_Assign (x, make_EOp (make_EVar(x), make_Plus(), make_EInt(1))) ``` E.g. here, `x` is shared. This causes problems for the C deallocater which assumes that it is dealing with a tree. This issue is left open for now.
Remaining problem (C): non-linear definitions, like: Line 25 in 228e2ef
This creates syntax trees that not trees but DAGs.
E.g. here, |
A bit off topic, but is there a deallocation function provided with the generated files? I haven't seen one, I've just been manually freeing recursively down the generated structs. |
Sharing introduced by definitions would result in a DAG, crashing the deallocator which assumes it is a tree.
This has been fixed by introduction of |
The original example for
define
by Ulf Norell is currently only accepted by the Haskell backends.bnfc/examples/DefinedRules.cf
Lines 22 to 23 in 3da1b0e
make_(:)
andmake_[]
.if
andfor
(keyword clash, regression), wrong list constructors.(:) (a,b)
instead of(a :: b)
.if
clashes withIf
. Works in 2.9.1 with--force
.Missing sanitization is a regression wrt. 2.9.1, introduced by #287.
The list constructors probably never worked.
The text was updated successfully, but these errors were encountered: