Here are some notes on what you can currently do with the code: = HsSqlSystem Command line access to a number of functions is provided by HsSqlSystem.lhs. You can list the commands using 'HsSqlSystem help', and you can get the descriptions of what these commands do using 'HsSqlSystem help all'. (Assuming you have cabal installed the software and have the cabal binary folder in your path.) The commands which access postgresql probably won't work right on your system, they are in a very early alpha state. The most interesting commands are: * parsefile * roundtripfile, loadsql * annotateSource * checksource == parsefile Pass in one or more filenames for files containing sql source, and the program will attempt to parse, then pretty print and reparse to see if the two asts are the same. This can be used to check the program can successfully parse your sql, and if pretty printing then parsing the result mangles it - lack of such mangling might give you slightly more confidence that it has parsed ok. == roundtripfile, loadsql Similar to parse file, pass in a source filename and a target filename, and the code with parse then pretty print the text. You can then load the pretty printed code into a database and run your test suite to see if the code made it through the parsing and pretty printing process ok, or you can just eyeball the resultant sql. The related command is loadsql, which will attempt to parse one or more files then pretty print them line by line, loading each line straight into a database to help with testing. This may be a bit more fragile than using roundtripfile. Loading the roundtripped sql into a database then running tests on it will hopefully can give a bit more confidence that the sql has been parsed accurately. == annotateSource This command takes a filename, parses and type checks the file, and then outputs a copy of the source with the main annotations attached to the statements interspersed into the source in comments. This can be used e.g. to view the attribute names and types of a view. After some more work has been done on this command, it is intended that this is expanded to provide lots of useful comments which are maintained in your actual source and checked in to source control, etc.. == checksource This command takes a set of files and type checks each one in turn (later files can depend on definitions appearing in files earlier in the file list). It outputs all the type errors found in Emacs friendly format. This mostly just shows you all the bits that haven't been implemented in the type checker yet. This is the early precursor to the lint checking process. Pretty printers and other work for the Annotation types are planned, to make the annotateSource comments and error messages more readable. == reasonably up to date output of './HsSqlSystem.lhs help all' commands available help use 'help' to see a list of commands use 'help all' to see a list of commands with descriptions use 'help [command]' to see the description for that command cleardb hacky util to clear a database loadsql This takes one or more files with sql source text, parses them then loads them into the database given. clearandloadsql cleardb then loadsql lexfile lex the file given and output the tokens on separate lines parsefile Routine to parse sql from a file, check that it appears to parse ok, that pretty printing it and parsing that text gives the same ast, and then displays the pretty printed version so you can see how well it's done roundtripfile Used to test the parsing and pretty printing round trip. Takes two arguments, a source filename and a target filename. If the target file exists, it quits. Parses the source file then pretty prints it to the target filename. readenv read the catalogs for the given db and dump a Environment value source text to stdout annotateSource reads a file, parses, type checks, then outputs info on each statement interspersed with the original source code checksource reads each file, parses, type checks, then outputs any type errors ================================================================================ = library usage See the haddock docs to get a basic idea of using the libraries. The source for HsSqlSystem.lhs might also be worth a look for some examples. You should be able to view the haddock docs online on the hackagedb page here: http://hackage.haskell.org/package/hssqlppp ================================================================================ = run the automated tests To run the test suite run ./HsSqlPppTests.lhs. This will run the tests for parsing and pretty printing, and for type checking.