HLInt is a lightweight, Python-based interpreter designed for the Hypothetical Language (HL) specification. It provides a full pipeline for source code processing, from lexical tokenization to syntax validation and execution flow.
- Pre-processing: Automated whitespace stripping and source normalization.
- Lexical Analysis: Tokenizes reserved words, identifiers, and operators with categorized symbol logging.
- Grammar Validation: Line-by-line syntax checking for variable declarations, assignments, and control flow.
- Diagnostic Outputs: Generates detailed artifact files (
NOSPACES.TXT,RES_SYM.TXT) for debugging the compilation pipeline.
HLInt implements a subset of procedural programming logic:
| Feature | Specification | Example |
|---|---|---|
| Data Types | Static typing for integers and doubles | var_name:integer; |
| Memory | Assignment via the := operator |
count:=10; |
| I/O Operations | Stream-based output | output<<variable; |
| Logic | Boolean conditional branching | If(x<y) output<<x; |
The interpreter operates in three distinct phases:
- Cleaner: Normalizes the raw
.hlinput into aNOSPACES.TXTbuffer. - Scanner: Performs a regex-based or state-machine pass to extract tokens.
- Parser: Validates tokens against the HL context-free grammar.
- Python: 3.6+
- OS: Cross-platform (Windows, macOS, Linux)
To analyze an HL source file, execute the core script via the CLI:
python HLInt.py [path_to_source_file]
Example:
python HLInt.py examples/PROG1.HL
NO ERROR(S) FOUND: The source code is syntactically valid.ERROR: The parser encountered a violation of HL grammar rules (check console output for line reference).
- Champagne Sheng T. Gonzales
- Joaquin Xavier S. Lajom
- Willard C. Soriano