Checkpoint for a parser rewrite (#2364)

The intent of this approach is to eliminate recursion limits as a barrier for the parser. While it may not be urgent to address, I want to avoid pouring effort into a parser approach that we don't think will be usable long-term.

Right now this is passing a minor set of tests. It's intended to be enough to show how I'm thinking about flow control for the parser. I'm manually switching back and forth because it seemed like the easiest approach that avoids duplicating tests.
This commit is contained in:
Jon Ross-Perkins
2022-11-02 14:43:40 -07:00
committed by GitHub
parent b6094c6a98
commit 9107916b11
9 changed files with 550 additions and 1 deletions
+3
View File
@@ -16,6 +16,7 @@
#include "llvm/Support/raw_ostream.h"
#include "toolchain/lexer/token_kind.h"
#include "toolchain/parser/parse_node_kind.h"
#include "toolchain/parser/parser2.h"
#include "toolchain/parser/parser_impl.h"
namespace Carbon {
@@ -27,6 +28,8 @@ auto ParseTree::Parse(TokenizedBuffer& tokens, DiagnosticConsumer& consumer)
TokenDiagnosticEmitter emitter(translator, consumer);
// Delegate to the parser.
// TODO: Edit this to swap between Parser and Parser2. This is manual in order
// to avoid test duplication.
return Parser::Parse(tokens, emitter);
}