C-Lite Interpreter

A minimal C language interpreter built with Python

Kavindu Methpura (E/20/254)

Department of Computer Engineering, University of Peradeniya

Module: CO523 - Programming Languages

About

Python-based interpreter for C-Lite, a simplified subset of C, covering three phases: Lexical Analysis, Syntax Analysis, and Semantic Evaluation.

Lead Developer

Kavindu Methpura

Kavindu Methpura

Engineering Undergraduate at the University of Peradeniya, specializing in Computer Engineering.

person View GitHub Profile

Features

code

Lexical Analyzer

Tokenizes raw source code

account_tree

Recursive-Descent Parser

Builds an Abstract Syntax Tree

terminal

AST Interpreter

Executes programs via tree traversal

table_chart

Symbol Table

Manages variable bindings and lifetimes

Pipeline

Source Code
arrow_right_alt
Lexer
arrow_right_alt
Parser
arrow_right_alt
AST
arrow_right_alt
Output

Syntax Evaluation

example.c
int x;
x = 10;
if (x > 5) {
    x = x - 1;
} else if (x == 5) {
    x = x + 2;
} else {
    x = x + 3;
}
printf(x);
Output: 9