hgom: An haskell port of the java version of gom

[ compiler, program ] [ Propose Tags ] [ Report a vulnerability ]

The executable hgom takes a module consisting of several abstract datatypes declarations as an input and ouputs java classes. It is meant to mimic the java version of Gom: http://tom.loria.fr/wiki/index.php5/Documentation:Gom.


[Skip to Readme]

Flags

Automatic Flags
NameDescriptionDefault
test

enable test support

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.5.1, 0.5.2, 0.5.3, 0.6
Change log CHANGELOG.markdown
Dependencies base (>=4 && <5), containers (>=0.2), directory (>=1.0.0.2), filepath (>=1.1.0.2), Glob (>=0.5), HUnit (>=1.2.2.1), mtl (>=1.1.0.2), parsec (>=3.0.0), process (>=1.0.1.1), QuickCheck (>=2), test-framework (>=0.2.4), test-framework-hunit (>=0.2.4), test-framework-quickcheck2 (>=0.2.5), wl-pprint (>=1.0) [details]
Tested with ghc >=6.10
License LicenseRef-GPL
Copyright (c) Paul Brauner 2009 (c) Emilie Balland 2009 (c) INRIA 2009
Author Paul Brauner and Emilie Balland
Maintainer Paul Brauner <paul.brauner@inria.fr>
Category Compiler
Home page http://github.com/polux/hgom
Uploaded by PaulBrauner at 2010-03-04T15:03:04Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Executables hgom
Downloads 3315 total (5 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2016-12-30 [all 8 reports]

Readme for hgom-0.6

[back to package description]

HGom

An haskell clone of the original java Gom code generator.

Compilation

To compile hgom, install cabal-install and type the following.

cabal configure
cabal build

The hgom binary is generated in dist/build/hgom.

Installation

cabal install

Generate developer documentation

By default, cabal generates no documentation since only the executable is exported. Developers still can generate the modules' documentation as follows.

cabal haddock --executables \
--html-location='http://hackage.haskell.org/packages/archive/$pkg/latest/doc/html' \
--hyperlink-source 

Only exported symbols are documented. Add --internal for unexported symbols documentation.

The documentation index is then dist/doc/html/hgom/hgom/index.html.

Running hgom

Run hgom --help to get some basic help. You can test the behaviour of hgom by running it as follows. Some examples are valid files, other ones demonstrate hgom error messages.

hgom examples/simple.gom
hgom examples/big.gom
hgom examples/many_errors.gom
...

Test

The test suite is compiled only if the test flag is set. For instance, run

cabal configure -ftest
cabal build
./dist/build/hgom/hgom --test "-a n"

or

cabal install -ftest
hgom --test "-a n"

where n is the number of generated random inputs for each test case.

For other arguments to the --test option, try hgom --test "--help".

Code Coverage

Code coverage can be tested as follows.

cabal build --ghc-options "-fhpc -fforce-recomp"
cd test/coverage
./coverage.sh

The documentation is generated in test/coverage/html.

Benchmark

There is some benchmark in test/bench that generates bigger and bigger gom files and runs hgom and gom on them, measuring the gom/hgom ratio concerning the number of generated lines (using sloccount) and the elapsed time.

cd test/bench
make

It takes some time. The generated files can be plotted using gnuplot for instance.

Differences with gom

Better

  • faster !
  • a far less permissive checker
  • smaller code, compiles much faster
  • almost 100% code coverage,
  • unit tests using QuickCheck, both on compiler data structures and generated code
  • regression tests for parser and checker
  • more things optional: visitable, checker, ...
  • toHaskell, makeRandom, depth and size methods generation (optional)
  • smaller code for some generated methods (string escaping factorized for instance)
  • faster code for some generated methods (less function calls, more constants)
  • faster parser (from*) methods: don't use an intermediate ATerm representation
  • pretty-printed generated code, optional compact (no indentation) option

Worse

  • no hooks!
  • no ant task
  • imports only builtins
  • generates no comments

Different

  • slightly different command-line arguments syntax