HsSqlPpp-0.4.0



Here are some limited notes on working on the source of hssqlppp:

Get the source

Please use the code from git to develop with, one way to get it is to run:

git clone https://github.com/JakeWheat/hssqlppp.git

Build the library

Once you have the source, you can build the library using cabal

cabal configure && cabal build

Rebuild the generated files for the syntax

If you edit the ag files, you need to rebuild AstInternal.hs. First make sure you have uuagc installed:

cabal install uuagc

Then use the makefile:

make src/Database/HsSqlPpp/Internals/AstInternal.hs

The makefile hasn't been heavily tested yet. If you have any problems with unrecognised modules, the complete list of packages referenced is in the Makefile (it may be missing build tools, such as cpphs, this hasn't been checked yet).

To just rebuild the library in the usual way after editing the ag files use:

make src/Database/HsSqlPpp/Internals/AstInternal.hs
cabal build

There is one further generated file, DefaultTemplate1Catalog.lhs. You don't usually need to regenerate this, but this is how you do it:

make regenDefaultTemplate1Catalog

Build and run the tests

You can build and run the tests using the makefile:

make tests

or to just build the tests, then run manually:

make src-extra/tests/Tests
src-extra/tests/Tests

This also rebuilds from the ag files if needed. When working on the source, this is usually the only compile command you need.

Background reading

The main things used in hssqlppp are: parsec, uuagc, generics, quasiquoting, pretty printing.

Parsec is used for parsing: Here is a tutorial for parsec which is outdated but isn't too bad for getting started: http://legacy.cs.uu.nl/daan/parsec.html

Chapter in Real World Haskell on parsec: http://book.realworldhaskell.org/read/using-parsec.html

UUAGC is used to assist the typechecking. It is also used to define the ast data types: http://www.cs.uu.nl/wiki/bin/view/HUT/AttributeGrammarSystem

A tutorial, not that easy to follow: http://www.cs.uu.nl/wiki/bin/view/HUT/AttributeGrammarManual

Pretty printing: http://hackage.haskell.org/package/pretty

Generics: Just uses a bit of this at the moment, mostly uses uniplate: http://community.haskell.org/~ndm/uniplate/

Quasiquotation: http://www.haskell.org/haskellwiki/Quasiquotation

The automated tests use test-framework and HUnit.

Source overview

weird bits:

TODO: make this less cryptic

A short guide on adding Syntax.