
Hi, Does Yhc currently recognize any pragmas in GHC format {-# PRAGMA-NAME parameters #-} or any other format? I need to include some comments in Haskell source to be recognized by the Javascript backend (such approach might be useful for other backends as well) but not by the compiler (therefore I need to aviod pragma name conflict), and if there is no format currently defined I'll stick with GHC one, or please express your objections/suggestions, if any. Thanks. PS I haven't looked into sources/docs yet: maybe someone better familiar with the compiler itself can answer faster. -- Dimitry Golubovsky Anywhere on the Web

"Dimitry Golubovsky"
Does Yhc currently recognize any pragmas in GHC format {-# PRAGMA-NAME parameters #-} or any other format?
The format {-# PRAGMA-NAME parameters #-} is defined by the Haskell'98 standard. There is a certain amount of basic support already in the parser: grep for "Pragma" in compiler/Parser/*.hs, and you will see that the parser knows what they look like, and can store them in a DeclAnnot constructor of the AST. However, no location in the grammar actually calls parsePragma at the moment. One needs to decide exactly where in the tree a pragma is valid (e.g. anywhere a Decl would be valid?). Then they need to be plumbed right through to where you need them. Regards, Malcolm
participants (2)
-
Dimitry Golubovsky
-
Malcolm Wallace