Move shared rule pointer factories into individual rule files

This commit is contained in:
Max Brunsfeld 2013-11-14 12:55:02 -08:00
parent 8a0a442a24
commit 040ec86000
19 changed files with 102 additions and 76 deletions

36
todo.md Normal file
View file

@ -0,0 +1,36 @@
TODO
====
# complete the list of rule types
- add repeat rules
- parse regex rules into trees of choices, sequences, repeats
# generate lexers for sets of terminal rules (can be mix of throwaway and meaningful)
Introduce ParseTable type which contains a vector of ParseStates. A ParseState contains a
TransitionMap of ParseActions. For a lexer, a ParseAction can be one of:
- Accept(symbol)
- Advance(state index)
Then generate a C function for a ParseTable
# generate parsers from sets of non-termina rules
For a Parser, the ParseActions can be any of:
- Accept(symbol)
- Shift(symbol)
- Reduce(symbol, number of child symbols)
# normalize grammars
- add concept of throwaway-terminals (tokens that won't appear in constructed AST)
- classify rules as non-terminals or terminals
- extract strings and regexes from non-terminal rules into their own throwaway-terminals,
in order to separate lexing from parsing
After this, a grammar will have these fields:
- non-terminal rules
- terminal rules
- throwaway terminal rules