Remove dump_grammar.lua, which was quite out-of-date.
[gazelle.git] / README
blobf6de0feeb4f5b336864c31f6501336e3b39ce8cf
2 Gazelle: a system for building fast, reusable parsers
4 <http://www.reverberate.org/gazelle/>
6 PRELIMINARY WARNING
7 ===================
9 This is experimental, immature software.  A few things work, but a lot of
10 things don't.  And everything is subject to change: the APIs, the grammar
11 language, everything.
13 Still with me?  Great. :)
15 BUILDING
16 ========
18 You need to have Lua installed to do anything interesting.  The C runtime
19 doesn't need Lua, but without Lua you can't compile any grammars.
21 Gazelle should build out-of-the-box on UNIX-like systems if Lua is installed.
22 Ubuntu Linux and Mac OS X are tested.  Just type make:
24 $ make
26 TRYING IT OUT
27 =============
29 Now you can do fun things.  First you'll want to set up your LUA_PATH,
30 which you can do using the easy "lua_path" script:
32 $ . lua_path
34 Now you can compile a grammar into byte-code.
36 $ lua compiler/compile.lua sketches/json.parser json.bc
37 Writing grammar to disk...
38 [...]
40 You can use dump_grammar to generate visual diagrams of the grammar in
41 graphviz format.
43 $ lua utilities/dump_grammar.lua json.bc 
44 Writing 1.dot...
45 [...]
46 $ dot -Tpng -o 1.png 1.dot  (you have to have Graphviz installed for this)
47 $ view 1.png
49 You can also parse some data using gzlparse.  However, you won't get
50 anything interesting from this (except a syntax error message if there
51 is a syntax error).  Well, you can use this to find out how fast Gazelle
52 is at the moment.
54 $ time ./utilities/gzlparse json.bc my-json-data.txt
56 ROADMAP OF THE SOURCE
57 =====================
59 compiler/
60   what parses the grammar, turns it into state machines, and dumps into bytcode
61 compiler/bootstrap
62   compiler code that will not be needed once Gazelle is self-hosting
63 lang_ext/
64   wrappers around the C runtime, for high-level languages (currently only Lua)
65 runtime/
66   the tiny, fast, small-memory-footprint C runtime that actually does the parsing
67 sketches/
68   code that is either half-written or for debugging-only
69 tests/
70   unit tests (not very many at the moment)
71 utilities/
72   command-line utilities for doing useful things
74 CONTACT
75 =======
77 Joshua Haberman <joshua@reverberate.org>