Skip to content

willardcsoriano/hypothetical-language-interpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HLInt: A Hypothetical Language Interpreter

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.

Key Features

  • 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.

Technical Specifications

Supported Constructs

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;

Architecture Overview

The interpreter operates in three distinct phases:

  1. Cleaner: Normalizes the raw .hl input into a NOSPACES.TXT buffer.
  2. Scanner: Performs a regex-based or state-machine pass to extract tokens.
  3. Parser: Validates tokens against the HL context-free grammar.

Installation & Usage

Environment Requirements

  • Python: 3.6+
  • OS: Cross-platform (Windows, macOS, Linux)

Running the Interpreter

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

Exit Codes & Output

  • 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).

Contributors

  • Champagne Sheng T. Gonzales
  • Joaquin Xavier S. Lajom
  • Willard C. Soriano

About

A lightweight Python interpreter for the Hypothetical Language (HL), handling tokenization, grammar validation, and execution flow.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages