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

Some backends do not implement the define pragma #266

Closed
5 tasks done
andreasabel opened this issue Nov 13, 2019 · 0 comments
Closed
5 tasks done

Some backends do not implement the define pragma #266

andreasabel opened this issue Nov 13, 2019 · 0 comments
Assignees
Labels
Milestone

Comments

@andreasabel
Copy link
Member

andreasabel commented Nov 13, 2019

The C backend does not implement the define pragma.

EMinus. Exp  ::= Exp "-" Exp1;
EInt.   Exp1 ::= Integer;
eNeg.   Exp1 ::= "-" Exp1;

coercions Exp 1;

define eNeg e = EMinus (EInt 0) e;

For this example,

bnfc --c -m Foo.cf && make

fails at compilation of Printer.c, which treats eNeg as variant just as EInt and EMinus.

The backends Haskell, Java, CPP, OCaml do support define.

Backends that do not support define:

  • Haskell --functor
  • C
  • Java/ANTLR
  • C++ NoSTL: Skeleton.C does not compile
  • C++ with namespace
@andreasabel andreasabel added the define Issue with define pragma label Jan 3, 2020
@andreasabel andreasabel changed the title C backend does not implement define pragma Some backends do not implement the define pragma Jan 3, 2020
@andreasabel andreasabel self-assigned this Jan 3, 2020
@andreasabel andreasabel added this to the 2.8.4 milestone Jan 3, 2020
andreasabel added a commit that referenced this issue Jan 3, 2020
andreasabel added a commit that referenced this issue Jan 3, 2020
When translating `define`d constructors to Haskell, we need to refer to
the native AST constructors in a qualified way (after the changes
introduced in #278).
andreasabel added a commit that referenced this issue Jan 3, 2020
If we refer to a defined constructor within another defined constructor,
the generated Haskell will still be incorrect.
andreasabel added a commit that referenced this issue Jan 18, 2020
In particular, in the presence of defined constructors, there should not
be excessive new lines.  (Re #266)
andreasabel added a commit that referenced this issue Apr 1, 2021
andreasabel added a commit that referenced this issue Apr 1, 2021
The transation to Ocaml syntax was missing some parentheses.
andreasabel added a commit that referenced this issue Dec 23, 2021
Also: Disable hlint warnings connected to writing lambdas instead of functions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant