From 3d3920f6d9388c46af6725dabb34d98752958d8d Mon Sep 17 00:00:00 2001 From: Ben Smith Date: Tue, 15 Aug 2017 14:36:20 -0700 Subject: Rewrite parser as recursive descent (#591) * Remove Bison dependency * Remove pre-generated parser files * Rename build config from no-re2c-bison to no-re2c * Add a simple make_unique implementation * Move handling of module bindings into ir.cc * Simplify lexer - Remove lookahead, the parser handles this now - Unify Token/LexerToken, it only contains terminal values now - Refactor setting token type and value into one function (e.g. LITERAL, RETURN => RETURN_LITERAL) * New Parser - Uses two tokens of lookahead (use Peek(0) or Peek(1)) - Consume() consumes one token of any kind - Match(t) consumes the current token if it matches - PeekMatch(t) returns true iff the token matches, but doesn't consume - Basic error synchronization; plenty of room for improvement here --- test/parse/bad-error-long-token.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/parse/bad-error-long-token.txt') diff --git a/test/parse/bad-error-long-token.txt b/test/parse/bad-error-long-token.txt index fce3fd2c..5236637d 100644 --- a/test/parse/bad-error-long-token.txt +++ b/test/parse/bad-error-long-token.txt @@ -1,7 +1,7 @@ ;;; ERROR: 1 abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz (;; STDERR ;;; -out/test/parse/bad-error-long-token.txt:2:15: error: unexpected token "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz" +out/test/parse/bad-error-long-token.txt:2:15: error: unexpected token "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz", expected a module field or a command. abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ;;; STDERR ;;) -- cgit v1.2.3