12345678910111213141516171819202122232425262728293031323334353637383940 |
- #ifndef PARSER_H
- #define PARSER_H
- #include <cstdio>
- #include <map>
- #include <string>
- #include <vector>
- #include "Lexer.h"
- #include "Ast.h"
- using namespace ast;
- namespace parser{
- static int CurTok;
- static std::map<char, int> BinopPrecedence;
- int getNextToken();
- static int GetTokPrecedence();
- std::unique_ptr<ExprAST> Error(const char *Str);
- std::unique_ptr<PrototypeAST> ErrorP(const char *Str);
- static std::unique_ptr<ExprAST> ParseExpression();
- static std::unique_ptr<ExprAST> ParseNumberExpr();
- static std::unique_ptr<ExprAST> ParseParenExpr();
- static std::unique_ptr<ExprAST> ParseIdentifierExpr();
- static std::unique_ptr<ExprAST> ParsePrimary();
- static std::unique_ptr<ExprAST> ParseBinOpRHS(int ExprPrec,
- std::unique_ptr<ExprAST> LHS);
- static std::unique_ptr<PrototypeAST> ParsePrototype();
- static std::unique_ptr<FunctionAST> ParseDefinition();
- static std::unique_ptr<FunctionAST> ParseTopLevelExpr();
- static std::unique_ptr<PrototypeAST> ParseExtern();
- static void HandleDefinition();
- static void HandleExtern();
- static void HandleTopLevelExpression();
- void MainLoop();
- }
- #endif
|