288 Commits

Author SHA1 Message Date
Niko Matsakis
350e46cc98 Change from ~X to <X> 2015-07-07 06:12:04 -04:00
Niko Matsakis
1a0c88f0bc modify parser so that Foo<Bar> is considered a macro invocation,
but `Foo <Bar>` is considered two distinct tokens
2015-07-07 05:47:36 -04:00
Niko Matsakis
909d1b0655 get all tests passing again after introducing validation step 2015-07-07 05:47:19 -04:00
Niko Matsakis
8fc9b609a4 fix error reporting in terms of spans etc (no automated tests for this, boo) 2015-07-03 13:14:38 -04:00
Yehuda Katz
6af13508c0 Fix typo 2015-07-03 09:54:29 -07:00
Niko Matsakis
1b46191fdc add validation an (incompletely utilized) unit testing framework, thread
spans through somewhat more
2015-07-02 15:31:43 -07:00
Niko Matsakis
dc9b6567ea thread spans through the parse-tree symbols, not sure why I didn't
do this in the first place
2015-07-02 13:15:37 -07:00
Niko Matsakis
48e3647748 make the DFA analyzer accept explicit precedences 2015-06-30 22:48:01 -07:00
Niko Matsakis
f85f133c3e combine the tests into one big executable so as to avoid having
to rebuild lalrpop once per test, and also avoid need to write a
makefile
2015-06-30 08:30:01 -07:00
Niko Matsakis
445c8e69ec introduce a dummy nonterminal for start symbols automatically 2015-06-30 08:05:15 -07:00
Niko Matsakis
dd83ec0cea reorganize lalrpop so that it is a library that can be added to
a project via build.rs, give a few examples of this in practice
2015-06-29 22:31:14 -07:00
Niko Matsakis
5e7dd66534 work on accepting parameters etc 2015-06-29 14:20:05 -07:00
Niko Matsakis
6192b0b2a1 refactor grammar to prevent undesirable nesting of symbols and
so forth
2015-06-25 22:39:11 -07:00
Niko Matsakis
388fbcb495 Sort and dedup lr1 states, fix a bunch of tests.
Change `~x:Foo` notation to just `x:Foo`
2015-06-24 07:17:55 -07:00
Niko Matsakis
fbc59064ef Update README 2015-06-24 06:03:57 -07:00
Niko Matsakis
d82b794bbe Move lalrpop code into a subdirectory 2015-06-24 05:53:24 -07:00
Niko Matsakis
79158121ec DFA is now basically working. 2015-06-23 22:14:23 -07:00
Niko Matsakis
73c1467590 add a few more tests 2015-06-23 14:58:37 -07:00
Niko Matsakis
74cb94a739 add testing for nfa 2015-06-23 14:54:36 -07:00
Niko Matsakis
9e6fc6df49 impl NFA/DFA conversion (untested) 2015-06-23 11:51:04 -07:00
Niko Matsakis
51e1f7eb67 Add a regular expression parser and NFA construction code 2015-06-23 09:23:11 -07:00
Niko Matsakis
4379b13c9d Make type inference smarter, based on the idea that all constraints must
have the same type; so if we see errors or cases where we cannot infer a
type, let's just take it from one of the successful alternatives. This
lets us remote the type annotation on `E` (or `T`, depending).
2015-06-22 14:14:03 -04:00
Niko Matsakis
2d53902a4f remove the name of the grammar, which wasn't really used for anything 2015-06-22 13:31:55 -04:00
Niko Matsakis
fc377940ed revamp a bit to lay groundwork for better patterns, make sub have actions 2015-06-22 13:08:38 -04:00
Niko Matsakis
1faf1d2841 Start extracting out a utility library with a tokenizer, main
fn, etc so I can write more tests
2015-06-22 09:42:19 -04:00
Niko Matsakis
411ff7a6d2 avoid emitting useless warnings 2015-06-22 08:57:43 -04:00
Niko Matsakis
15f1cd1c15 It's alive! It's alive! 2015-06-22 08:51:28 -04:00
Niko Matsakis
7fa99e7c7f emit uses etc 2015-06-22 08:41:49 -04:00
Niko Matsakis
f8cc8858d7 let user declare use foo 2015-06-22 06:06:58 -04:00
Niko Matsakis
65d4e0b498 prefix all the names; add some #[cfg(test)] attributes 2015-06-22 05:56:56 -04:00
Niko Matsakis
5ee2824726 break out state code into its own module, use __ prefix more
so that (eventually) we can bring in user-defined imports
2015-06-22 05:49:33 -04:00
Niko Matsakis
e04d65056b generate a start fn 2015-06-22 05:16:12 -04:00
Niko Matsakis
bc4172b556 Create a main routine that generates the recursive ascent code 2015-06-21 20:56:38 -04:00
Niko Matsakis
d80403e462 add recursive ascent code; completely untested (not even reachable),
but seemingly...complete-ish?
2015-06-21 07:26:07 -04:00
Niko Matsakis
72be539541 intermediate checkpoint: creating rust IR, which may not be worthwhile 2015-06-20 19:43:08 -04:00
Niko Matsakis
13bc31f0ee add a random parse tree generation facility, use it to provide random inputs 2015-06-20 18:02:52 -04:00
Niko Matsakis
c9502edefd add a comment 2015-06-20 08:33:09 -04:00
Niko Matsakis
fadd3f2c66 Make a general prefix we can use for later 2015-06-20 08:32:01 -04:00
Niko Matsakis
5c71e53c6b distinguish lifetimes of the state table from the underlying grammar 2015-06-20 06:03:15 -04:00
Niko Matsakis
a661d9ee94 add an LR(1) interpreter that executes the action tables and constructs
a parse-tree. Use is to test the results from the LR(1) table generation
algorithm.
2015-06-20 05:43:06 -04:00
Niko Matsakis
077ed9060d build up action tables 2015-06-19 19:03:21 -04:00
Niko Matsakis
c66f7e2d40 lr1 construction seems to be working, tests are not yet really stable 2015-06-19 17:28:03 -04:00
Niko Matsakis
990f2a931a sketch out the state enumeration algorithm 2015-06-19 13:27:24 -04:00
Niko Matsakis
b324075eb3 expand test to test when we are in the middle of a configuration 2015-06-19 10:35:10 -04:00
Niko Matsakis
8c577422bf Start the naive LR(1) algorithm with support for transitive closures
over epsilon moves
2015-06-19 10:17:35 -04:00
Niko Matsakis
4e5204078a Start working on a naive LR(1) algorithm (seems like a good starting
point). Implement first set computation.
2015-06-19 06:42:11 -04:00
Niko Matsakis
334a419c49 Make newtypes for TerminalString and NonterminalString, among other
refactorings. I found it was annoying keeping them straight.
2015-06-19 05:30:43 -04:00
Niko Matsakis
048def7654 rather than the hacky Debug impl, just only compare stuff that is more
stable (and more imp't anyway)
2015-06-18 06:34:19 -04:00
Niko Matsakis
8dd121a8e7 lower test passes 2015-06-18 06:13:18 -04:00
Niko Matsakis
088ad2f444 remove two unused imports 2015-06-18 05:57:48 -04:00