123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #ifndef _PARSER_H
- #define _PARSER_H
- // Standard includes
- #include <map>
- // Local includes
- #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> ParseIfExpr();
- static std::unique_ptr<ExprAST> ParseForExpr();
- static std::unique_ptr<ExprAST> ParsePrimary();
- static std::unique_ptr<ExprAST> ParseUnary();
- 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
|