diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-16 13:21:05 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-16 13:21:05 +0000 |
| commit | e44bdc6a2a0cf624b08046ecc7e5c5d5d9d2d66c (patch) | |
| tree | f5276cc0dd2f34e4d30a58f80223912265a1c5a0 /include/cps/Parser.h | |
| parent | e1e789ac0249149a4aa1671f5f9260d488cb617a (diff) | |
fix(compiler): correct CIE semantics and diagnostic locations
Use standard WHILE headers and default-public class fields, resolve
pseudocode identifiers without case sensitivity, and check signed i64
literal boundaries before conversion. Preserve source locations across
recursive emission and function diagnostics.
Add 22 regression cases and update compiler examples and documentation.
Validated all 69 CTest entries with the original Linux Actions seed and
verified the release package's embedded, native and IR output paths.
Diffstat (limited to 'include/cps/Parser.h')
| -rw-r--r-- | include/cps/Parser.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/include/cps/Parser.h b/include/cps/Parser.h index 0079c8b..fdbb99a 100644 --- a/include/cps/Parser.h +++ b/include/cps/Parser.h @@ -1,4 +1,5 @@ #pragma once +#include "cps/Identifier.h" #include "cps/Lexer.h" #include "cps/AST.h" #include "cps/TypeAST.h" @@ -24,7 +25,7 @@ class Parser { unsigned BlockDepth = 0; // ParseBlock nesting; 1 = top level std::map<int, int> BinopPrecedence; - std::set<std::string> TypeNames = { + IdentifierSet TypeNames = { "INTEGER", "REAL", "BOOLEAN", "STRING", "CHAR", "VOID", "C_INT", "C_CHAR", "C_STRING", "C_DOUBLE" }; @@ -33,7 +34,9 @@ class Parser { int GetTokPrecedence(); std::unique_ptr<ExprAST> ParseExpression(); + std::unique_ptr<ExprAST> ParseUnaryImpl(); std::unique_ptr<ExprAST> ParseUnary(); + std::unique_ptr<ExprAST> ParsePrimaryImpl(); std::unique_ptr<ExprAST> ParsePrimary(); std::unique_ptr<ExprAST> ParseBinOpRHS(int ExprPrec, std::unique_ptr<ExprAST> LHS); @@ -71,6 +74,7 @@ class Parser { std::unique_ptr<StmtAST> ParseCallStmt(); std::unique_ptr<StmtAST> ParseReturnStmt(); std::optional<std::vector<ParamDecl>> ParsePrototypeArgs(bool AllowByRef); + bool ParseIntegerValue(bool Negative, int64_t &Out); bool ParseSignedIntBound(int64_t &Out); std::unique_ptr<StmtAST> ParseOpenFile(); |
