This project implements a compiler for the Lambda programming language, translating Lambda code into C99. The compiler is built using Flex (lexical analyzer) and Bison (parser generator).
mylexer.l- Flex lexical analyzer definitionmyanalyzer.y- Bison parser and code generatorcgen.c/h- Code generation utilitieslambdalib.h- Runtime library for Lambda programsLambdaExamples/- Example Lambda programs:bookstore.la- Object-oriented bookstore management systemprime.la- Prime number generatorqsort.la- Quicksort implementationqsort_comprehension.la- Quicksort using list comprehensionstest_input.la- Simple I/O example
- Object-oriented programming with
comp(component) definitions - List comprehensions
- Built-in types: integer, scalar (float), string, boolean
- Control structures: if-else, while, for
- Arrays and array operations
- Function definitions with return types
- Macro support with
@defmacro - Rich standard library for I/O operations
make./analyzer <input_file.la>This will generate a Result.c containing the C99 code for the Lambda program.
Cleaning Up:
make cleanCheck the LambdaExamples/ directory for example Lambda programs. You can run them by compiling the generated C code:
If you run the project on a Linux system, you need to have the following packages installed:
flexbison
You can run the project on Windows using WSL (Windows Subsystem for Linux) but keep in mind that you have to install the required packages in WSL.
This project is licensed under the GNU General Public License v3.0 (GPL-3.0). See the LICENSE file for details.
This project was developed as part of the Computation Theory course at the Technical University of Crete.