nitcc: remove forgotten debugging print
[nit.git] / contrib / nitcc / README.md
1 # nitcc, a parser and lexer generator for Nit
2
3 nitcc is a simple LR generator for Nit programs.
4 It features a small subset of the functionalities of [SableCC] 3 and 4.
5
6   [SableCC]: http://sablecc.org
7
8 ## How to compile
9
10 Have a valid compiler in `bin/`
11 Just run `make` in the `contrib/nitcc/` directory
12
13 ## How to run
14
15 Usage:
16
17     nitcc file.sablecc
18
19 nitcc generates a bunches of control files, a lexer, a parser, and a tester.
20
21 To compile and run the tester:
22
23     nitg file_test_parser.nit
24     ./file_test_parser an_input_file_to_parse
25
26 ## Examples and regression tests
27
28 The sub-directory `examples/` contains simple grammars and interpretors.
29
30 The sub-directory `tests/` contains regression tests.
31
32 ## Features (aka TODO list)
33
34 [X] command line tool (`nitcc`)
35 [X] Grammar syntax of SableCC4 (with pieces of SableCC3)
36 [X] Generates a Lexer
37 [X] Generates a SLR parser
38 [ ] Generates a LALR parser
39 [X] Generates classes for the AST and utils
40
41 For the tool (and the code)
42
43 [X] usable
44 [X] bootstrap itself (see `nitcc.sablecc`)
45
46 For the lexer (and regexp, NFA en DFA)
47
48 [X] Any
49 [X] interval of characters and subtraction of characters
50 [X] implicit priorities (by inclusion of languages)
51 [X] Except and And
52 [X] Shortest and Longest (but dummy semantic without lookahead)
53 [X] efficient implementation of intervals
54 [X] DFA minimization
55
56 For the parser (and grammar and LR)
57
58 [X] Modifiers (`?`, `*`, `+`)
59 [X] Ignored
60 [X] Rejected
61 [ ] Opportunistic
62 [ ] Precedence
63 [ ] Separator
64 [ ] Dangling
65 [X] simple transformation
66 [x] simple inlining
67
68 For the AST (generated classes, utils and their API)
69
70 [X] Common runtime-library `nitcc_runtime.nit`
71 [X] Terminal nodes; see `NToken`.
72 [X] Heterogeneous non-terminal nodes: named fields; see `NProd`.
73 [X] Homogeneous nodes for lists (`+` and `*`); see `Nodes`.
74 [X] Visitor design pattern; see `Visitor`.
75 [X] Syntactic and lexical errors; see `Nerror`.
76 [X] positions of tokens in the input stream; see `Position`
77
78 ## BUGS and limitations
79
80 * Limited error checking; bad grammars can produce uncompilable, or worse buggy, nit code.
81 * The SLR automaton is not very expressive; do not except to parse big and complex language like Nit or Java.
82 * The generated Nit code is inefficient and large; do not except to parse big and complex language like Nit or Java.
83 * No unicode.
84 * Advanced features of SableCC4 are not planed.
85