//===- Parser.h - Toy Language Parser -------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file implements the parser for the Toy language. It processes the Token // provided by the Lexer and returns an AST. // //===----------------------------------------------------------------------===// #ifndef TOY_PARSER_H #define TOY_PARSER_H #include "toy/AST.h" #include "toy/Lexer.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/raw_ostream.h" #include <map> #include <utility> #include <vector> #include <optional> namespace toy { /// This is a simple recursive parser for the Toy language. It produces a well /// formed AST from a stream of Token supplied by the Lexer. No semantic checks /// or symbol resolution is performed. For example, variables are referenced by /// string and the code could reference an undeclared variable and the parsing /// succeeds. class Parser { … }; } // namespace toy #endif // TOY_PARSER_H