The source tree for happy
contains AttrGrammarParser.ly
and Parser.ly
and the source tree for alex
contains Scan.x
. Yet, as far as I can tell in order to compile happy
, we need to transform the .ly
files into .lhs
files using... happy
, and in order to compile alex
we need to transform the .x
files into .hs
files using... alex
.
So it seems like there must be some bootstrapping going on here in order to compile either tool.
The Setup.lhs
files for each project contain some template expansion, but, as far as I can tell, don't do anything in particular to do the bootstrapping.
How and where is the bootstrapping done?
I see that you are looking at the source tree of the darcs repositories for these packages on darcs.haskell.org. If you look at the actual tarballs on Hackage, you'll see something a bit different:
https://hackage.haskell.org/package/alex-3.1.4/src/dist/build/alex/alex-tmp/
https://hackage.haskell.org/package/happy-1.19.5/src/dist/build/happy/happy-tmp/
So basically the build artifacts necessary are shipped with the Hackage tarball. Cabal then just uses the build artifacts during the build process, thus avoiding the need to bootstrap locally. Cabal also knows how to preserve such build artifacts when you run cabal sdist
for your own packages which you want not to depend on happy or alex, but last I checked this doesn't interoperate well with sandboxes, fwiw.
By the way, alex and happy development has moved to github:
https://github.com/simonmar/alex/
https://github.com/simonmar/happy/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With