Back to Projects
Compiler

Hyper Text Programming Language

Hyper Text Programming Language (HTPL) is custom programming language inspired by HTML/XML syntax. The system performs lexical analysis, syntax analysis (LL(1), recursive descent, and Bison), semantic analysis, and intermediate code generation using quadruplets, ensuring syntactic and semantic correctness.

January 2026Updated Jan 2026
Hyper Text Programming Language

Overview

HTPL Compiler is an academic compilation project developed as part of the Compiler Design course (2CS – Software & Systems Engineering). The goal was to design a complete programming language named HTPL, inspired by the structure and readability of HTML/XML, and to build a functional compiler capable of analyzing and validating HTPL programs.

The compiler covers all core compilation stages:

  • Lexical analysis to tokenize the source code
  • Syntax analysis to validate grammatical structure (LL(1), recursive descent, and Bison-based parsing)
  • Semantic analysis to ensure logical consistency (types, declarations, scope, arrays, and runtime safety checks)
  • Intermediate code generation using quadruples, including control flow handling

My Contribution

Within the team, I actively contributed to multiple key parts of the project, including:

  • Designing and refining the HTPL language syntax (variables, control structures, expressions)
  • Implementing and validating parts of the syntax analysis, using both recursive descent and Bison
  • Developing and managing the symbol table for type checking, variable tracking, and array validation
  • Implementing semantic checks such as undeclared variables, type compatibility, and array bounds
  • Contributing to the generation of intermediate code (quadruplets) for expressions, if/else, and while constructs, including label and jump management
  • Improving error handling by tracking line and column positions between the lexer and parser

Key Features

Custom Programming Language (HTPL)

  • HTML/XML-inspired syntax for clarity and readability
  • Primitive types: int, float, bool, string
  • Typed arrays with size validation
  • Core instructions: assignment, input/output, conditionals, loops
  • Arithmetic and logical expressions with proper operator precedence

Dual Parsing Approaches

  • Manual LL(1) recursive descent parser
  • Bison-generated parser with controlled associativity and precedence rules

Semantic Analysis & Safety

  • Type compatibility checks
  • Detection of undeclared or redeclared variables
  • Array bounds verification
  • Division-by-zero detection (when statically determinable)

Intermediate Code Generation

  • Quadruple-based representation
  • Temporary variable management
  • Control-flow support (branches, loops, nested structures)

Outcome

  • A fully defined and documented programming language (HTPL)
  • A working compiler covering all major compilation phases
  • Strong practical understanding of compiler theory applied to real implementations
  • A collaborative project combining language design, algorithms, and low-level systems programming

Skills and Tools

Lex/FlexBisonCCompiler DesignParsingStatic Semantic Checking

Project Links