Skip to content

Make backends more resilient against keyword and Prelude clashes #278

@andreasabel

Description

@andreasabel

OP: Haskell: Printer: variable name "pattern" might clash with PatternSynonyms language extension.

Prg. Program ::= Pattern;
PVar. Pattern ::= Ident;

creates Haskell printer containing:

instance Print Test.Abs.Program where
  prt i e = case e of
    Test.Abs.Prg pattern -> prPrec i 0 (concatD [prt 0 pattern])

However, pattern is a Haskell keyword when using {-# LANGUAGE PatternSynonyms #-}.

When trying to get a test case through that has one category for each keyword of each backend target, I notice a number of related issues:

  • Haskell abstract syntax: avoid Prelude clashes
  • Haskell template: import Abs module qualified to avoid clashes
  • Haskell parser: import Abs qualified
  • Agda AST: import Abs qualified in COMPILE pragmas
  • Haskell/GADT: same as Haskell
  • C: clash of user-defined category Int with token type int in parser
  • C++: same as C
  • Ocaml: refer to abstract syntax qualified in print/show
  • Java: qualified absyn, names need to be unique modulo case (case insensitive file systems!)
  • Java/ANTLR: labels for alternatives may clash with rule names

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions