The EEL (Extended Expression Language) Interpreter is a C implementation of an interpreter for a custom expression language developed as part of the CS 429 course. This project provides a command-line interface (CI) that allows users to evaluate expressions written in the EEL language.
-
Core Components:
- Lexer: Tokenizes input strings into lexemes (
lex.c) - Parser: Builds abstract syntax trees from tokens (
parse.c) - Evaluator: Evaluates parsed expressions (
eval.c) - Variable Management: Handles variable definitions and lookups (
variable.c) - Error Handler: Provides robust error handling (
err_handler.c)
- Lexer: Tokenizes input strings into lexemes (
-
Support Files:
ci.h: Main header file with function declarations and shared variablestoken.h: Token definitions for the lexernode.h: Node structure for the abstract syntax treevalue.h&type.h: Value and type system definitionsMakefile: Build configuration
- Arithmetic operations
- String manipulation
- Comparison operators
- Ternary conditional expressions
- Variable assignment and retrieval
- Robust error handling
The EEL language supports various operations including:
- String operations (concatenation, repetition, comparison)
- Numeric operations (addition, subtraction, multiplication, division)
- Type conversion
- Boolean operations
To build the interpreter:
make ciTo run the interpreter:
./ciTo run tests:
make testTo check for memory leaks:
make memtestThe tests/ directory contains various test files to verify different aspects of the interpreter:
test_string.txt: String operationstest_binary.txt: Binary operationstest_ternary.txt: Ternary conditional expressionstest_variable.txt: Variable assignment and usagetest_unary.txt: Unary operations
Copyright (c) 2021. S. Chatterjee, X. Shen, T. Byrd. All rights reserved. May not be used, modified, or copied without permission.