Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
37 lines (23 sloc) 1.11 KB
http://github.com/BNFC/bnfc
https://github.com/BNFC/bnfc/blob/0b2ec88c532e1844fa79d44d97047d6c7ca2fb9a/examples/haskell-core/Core.cf
A grammar for GHC External Core.
(c) Aarne Ranta 2003 under GNU GPL.
The grammar is in Core.cf and it is compiled with
bnfc -m Core.cf ; make
To test it on an ext-core file, either do
hugs -P.:/home/aarne/BNFC: TestCore.hs
hugsprompt> runFile pModule "<file.hcr>"
or, if the file is big,
ghc --make -i/home/aarne/BNFC TopCore.hs -o TopCore
./TopCore <file.hcr>
replacing /home/aarne/BNFC with your BNFC directory in both cases.
I guess there will be some problems with qualified/unqualified
identifiers depending on GHC version. Mine is fairly old, 5.02.2.
The .hcr files in the package core.tgz are generated by that,
so they will work at least.
BNF Converter grammar for GHC External Core.
(c) Aarne Ranta 6/11/2003 under GNU GPL
on the basis of ExternalCore.lhs and ParserExternalCore.y
from the University of Glasgow (2001)
Differences from source abstract syntax are marked with ---
Grammar in a broad sense fetched automatically by Vadim Zaytsev, http://grammarware.net