|
MXVM 1.8.1
Virtual Machine, Compiler, and Pascal Frontend
|
Classes | |
| class | ASTNode |
| Abstract base class for all AST nodes. More... | |
| class | ExitNode |
| AST node for an exit / halt statement. More... | |
| class | ContinueNode |
| AST node for a continue statement. More... | |
| class | BreakNode |
| AST node for a break statement. More... | |
| class | BlockNode |
| AST node representing a block (declarations + compound statement). More... | |
| class | ProgramNode |
| AST node for a complete program (program name + block). More... | |
| class | UnitNode |
| AST node for a Pascal unit (separately compiled module). More... | |
| class | VarDeclNode |
| AST node for variable declarations (var id1, id2 : type). More... | |
| class | TypeDeclNode |
| AST node for a type declaration section. More... | |
| class | TypeAliasNode |
| AST node for a type alias (type NewName = ExistingType). More... | |
| class | ConstDeclNode |
| AST node for constant declarations (const id = value). More... | |
| class | FuncDeclNode |
| AST node for a function declaration. More... | |
| class | ProcDeclNode |
| AST node for a procedure declaration. More... | |
| class | ParameterNode |
| AST node for a formal parameter list entry. More... | |
| class | CompoundStmtNode |
| AST node for a compound statement (begin ... end). More... | |
| class | AssignmentNode |
| AST node for an assignment statement (variable := expression). More... | |
| class | SimpleTypeNode |
| AST node for a simple (named) type reference. More... | |
| class | ArrayTypeNode |
| AST node for an array type (array[lower..upper] of elementType). More... | |
| class | ArrayDeclarationNode |
| AST node for a named array variable declaration. More... | |
| class | ArrayTypeDeclarationNode |
| AST node for a named array type declaration (type Name = array[...]). More... | |
| class | ArrayAccessNode |
| AST node for an array element access (arr[index]). More... | |
| class | ArrayAssignmentNode |
| AST node for assigning to an array element (arr[index] := value). More... | |
| class | IfStmtNode |
| AST node for an if-then-else statement. More... | |
| class | WhileStmtNode |
| AST node for a while loop (while cond do stmt). More... | |
| class | ForStmtNode |
| AST node for a for loop (for var := start to/downto end do stmt). More... | |
| class | CaseStmtNode |
| AST node for a case statement. More... | |
| class | ProcCallNode |
| AST node for a procedure call statement. More... | |
| class | BinaryOpNode |
| AST node for a binary operator expression. More... | |
| class | UnaryOpNode |
| AST node for a unary operator expression. More... | |
| class | FuncCallNode |
| AST node for a function call expression. More... | |
| class | VariableNode |
| AST node for a variable reference. More... | |
| class | NumberNode |
| AST node for an integer or real numeric literal. More... | |
| class | StringNode |
| AST node for a string literal. More... | |
| class | BooleanNode |
| AST node for a boolean literal (true / false). More... | |
| class | EmptyStmtNode |
| AST node for an empty statement (no-op). More... | |
| class | NilNode |
| AST node for the nil literal. More... | |
| class | PointerTypeNode |
| AST node for a pointer type declaration (^BaseType). More... | |
| class | PointerDerefNode |
| AST node for a pointer dereference (ptr^). More... | |
| class | AddressOfNode |
| AST node for an address-of expression (@operand). More... | |
| class | RepeatStmtNode |
| AST node for a repeat..until loop. More... | |
| class | EnumTypeDeclNode |
| AST node for an enumerated type declaration (type Color = (Red, Green, Blue)). More... | |
| struct | VariantArm |
| A single variant arm inside a variant record. More... | |
| class | RecordTypeNode |
| AST node for a record type (record ... end). More... | |
| class | RecordDeclarationNode |
| AST node for a named record declaration. More... | |
| class | WithStmtNode |
| AST node for a with statement (with record do statement). More... | |
| class | GotoStmtNode |
| AST node for a goto statement. More... | |
| class | LabelStmtNode |
| AST node for a label definition (label: statement). More... | |
| class | SetLiteralNode |
| AST node for a set literal [val1, val2, ...]. More... | |
| class | SetTypeNode |
| AST node for a set type declaration (set of <base type>). More... | |
| class | FieldAccessNode |
| AST node for accessing a record field (record.field). More... | |
| class | ASTVisitor |
| Abstract visitor interface for the AST (double-dispatch). More... | |
| struct | ArrayInfo |
| Metadata describing a Pascal array's bounds, element type, and sizing. More... | |
| class | BuiltinFunctionHandler |
| Abstract handler for a group of built-in functions/procedures. More... | |
| class | BuiltinFunctionRegistry |
| Registry of BuiltinFunctionHandler instances. More... | |
| class | IOFunctionHandler |
| Built-in handler for I/O procedures (write, writeln, read, readln). More... | |
| class | StdFunctionHandler |
| Built-in handler for standard library functions (chr, ord, inc, dec, etc.). More... | |
| class | StringFunctionHandler |
| Built-in handler for string library functions (length, copy, concat, etc.). More... | |
| class | SDLFunctionHandler |
| Built-in handler for SDL2 bindings. More... | |
| class | FileFunctionHandler |
| Built-in handler for Pascal file I/O procedures (assign, reset, rewrite, append, close, eof, eoln). More... | |
| class | CodeGenVisitor |
| AST visitor that generates MXVM intermediate code. More... | |
| class | ParseException |
| Exception thrown on parse errors. More... | |
| class | PascalParser |
| Recursive-descent parser for the Pascal language. More... | |
Enumerations | |
| enum class | VarType { INT , DOUBLE , STRING , CHAR , RECORD , PTR , BOOL , UNKNOWN , ARRAY_INT , ARRAY_DOUBLE , ARRAY_STRING } |
| Enumeration of variable / expression value types. More... | |
Functions | |
| static std::string | rtrim_comment (const std::string &line) |
| static std::string | trim (const std::string &s) |
| static void | locate_sections (const std::vector< std::string > &lines, size_t &dataStart, size_t &dataEnd, size_t &codeStart, size_t &codeEnd) |
| static std::unordered_set< std::string > | collect_used (const std::vector< std::string > &lines, size_t codeStart, size_t codeEnd) |
| static void | sweep_unused_data (std::vector< std::string > &lines) |
| static std::vector< std::pair< size_t, std::string > > | nextNonEmpty (const std::vector< std::string > &code, size_t start, size_t n) |
| static std::string | invertJump (const std::string &j) |
| static bool | parse2 (const std::string &line, const std::string &op, std::string &a, std::string &b) |
| static bool | parse1 (const std::string &line, const std::string &op, std::string &a) |
| static bool | parseJump (const std::string &line, std::string &jop, std::string &label) |
| static bool | isLabelDef (const std::string &line, const std::string &label) |
| static void | foldCmpTest (std::vector< std::string > &code) |
| static void | foldAndTest (std::vector< std::string > &code) |
| static void | foldOrTest (std::vector< std::string > &code) |
| static bool | isRegisterName (const std::string &s) |
| Forward declaration — checks whether a name is a hardware register. | |
| static void | copyPropagation (std::vector< std::string > &code) |
| Copy-propagation peephole pass. | |
| static void | foldMovArithMov (std::vector< std::string > &code) |
| static void | peepholeOpt (std::vector< std::string > &code) |
| std::string | mxvmOpt (const std::string &text) |
| static std::string | toLower (const std::string &s) |
| Convert a string to lowercase for case-insensitive comparison. | |
Variables | |
| std::unordered_set< std::string > | sdlFunctions |
| std::unordered_set< std::string > | stdFunctions |
| static std::unordered_set< std::string > | fileFunctions |
|
strong |
Enumeration of variable / expression value types.
|
static |
Definition at line 60 of file icode.cpp.
Referenced by sweep_unused_data().
|
static |
Copy-propagation peephole pass.
Folds sequences like mov reg, src ; op reg, rhs into op src, rhs when the intermediate register is not referenced again. The scan respects ret / done boundaries so that stores to global variables visible to the caller are never eliminated.
Definition at line 376 of file icode.cpp.
References isRegisterName(), parse2(), rtrim_comment(), and trim().
Referenced by peepholeOpt().
|
static |
Definition at line 253 of file icode.cpp.
References isLabelDef(), nextNonEmpty(), parse1(), and parse2().
Referenced by peepholeOpt().
|
static |
Definition at line 166 of file icode.cpp.
References invertJump(), isLabelDef(), nextNonEmpty(), parse1(), parse2(), parseJump(), rtrim_comment(), and trim().
Referenced by peepholeOpt().
|
static |
Definition at line 501 of file icode.cpp.
References isRegisterName(), parse2(), rtrim_comment(), and trim().
Referenced by peepholeOpt().
|
static |
Definition at line 306 of file icode.cpp.
References isLabelDef(), nextNonEmpty(), parse1(), and parse2().
Referenced by peepholeOpt().
|
static |
Definition at line 108 of file icode.cpp.
Referenced by foldCmpTest().
|
static |
Definition at line 162 of file icode.cpp.
Referenced by foldAndTest(), foldCmpTest(), and foldOrTest().
|
static |
Forward declaration — checks whether a name is a hardware register.
Used by the peephole optimizer to distinguish register temporaries from global/local variable names when deciding whether a store is dead.
Definition at line 491 of file icode.cpp.
Referenced by copyPropagation(), foldMovArithMov(), and mxvmOpt().
|
static |
Definition at line 33 of file icode.cpp.
Referenced by mxvmOpt(), and sweep_unused_data().
| std::string pascal::mxvmOpt | ( | const std::string & | text | ) |
Definition at line 589 of file icode.cpp.
References isRegisterName(), locate_sections(), peepholeOpt(), rtrim_comment(), sweep_unused_data(), and trim().
Referenced by compileFile().
|
static |
Definition at line 97 of file icode.cpp.
References rtrim_comment(), and trim().
Referenced by foldAndTest(), foldCmpTest(), and foldOrTest().
|
static |
Definition at line 145 of file icode.cpp.
References trim().
Referenced by foldAndTest(), foldCmpTest(), and foldOrTest().
|
static |
Definition at line 132 of file icode.cpp.
References trim().
Referenced by copyPropagation(), foldAndTest(), foldCmpTest(), foldMovArithMov(), and foldOrTest().
|
static |
|
static |
Definition at line 579 of file icode.cpp.
References copyPropagation(), foldAndTest(), foldCmpTest(), foldMovArithMov(), and foldOrTest().
Referenced by mxvmOpt().
|
inlinestatic |
Definition at line 15 of file icode.cpp.
Referenced by copyPropagation(), foldCmpTest(), foldMovArithMov(), mxvmOpt(), and nextNonEmpty().
|
static |
Definition at line 74 of file icode.cpp.
References collect_used(), and locate_sections().
Referenced by mxvmOpt().
|
static |
Convert a string to lowercase for case-insensitive comparison.
| s | Input string |
s Definition at line 16 of file icode_imp.cpp.
Referenced by pascal::FileFunctionHandler::canHandle(), pascal::IOFunctionHandler::canHandle(), pascal::SDLFunctionHandler::canHandle(), pascal::StdFunctionHandler::canHandle(), pascal::StringFunctionHandler::canHandle(), pascal::FileFunctionHandler::generate(), pascal::IOFunctionHandler::generate(), pascal::FileFunctionHandler::generateWithResult(), pascal::IOFunctionHandler::generateWithResult(), pascal::FileFunctionHandler::getReturnType(), and pascal::StringFunctionHandler::getReturnType().
|
inlinestatic |
Definition at line 25 of file icode.cpp.
Referenced by copyPropagation(), foldCmpTest(), foldMovArithMov(), mxvmOpt(), nextNonEmpty(), parse1(), parse2(), and parseJump().
|
static |
Definition at line 985 of file icode_imp.cpp.
Referenced by pascal::FileFunctionHandler::canHandle().
| std::unordered_set<std::string> pascal::sdlFunctions |
Definition at line 23 of file icode_imp.cpp.
Referenced by pascal::SDLFunctionHandler::canHandle().
| std::unordered_set<std::string> pascal::stdFunctions |
Definition at line 40 of file icode_imp.cpp.
Referenced by pascal::StdFunctionHandler::canHandle().