https://github.com/filipczuba/lec-fe
C++ based copiler for LLVM's Kaleidoscope language.
https://github.com/filipczuba/lec-fe
Last synced: about 2 months ago
JSON representation
C++ based copiler for LLVM's Kaleidoscope language.
- Host: GitHub
- URL: https://github.com/filipczuba/lec-fe
- Owner: filipczuba
- License: mit
- Created: 2024-06-10T22:59:26.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-07-09T10:55:04.000Z (10 months ago)
- Last Synced: 2025-02-05T06:36:10.406Z (3 months ago)
- Language: C++
- Homepage:
- Size: 53.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Kaleidoscope Compiler
This repository contains an implementation of the Kaleidoscope language, a simple language introduced in the [LLVM Tutorial](https://llvm.org/docs/tutorial/). This project has been made for the Compilers course held at the University of Modena and Reggio Emilia.
## Table of Contents
- [Features](#features)
- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Usage](#usage)
- [License](#license)## Features
- Arithmetic and boolean operations;
- Local and global variable definitions and assignments;
- Control flow constructs (if/else and for loops);
- Function definitions and calls;
- Arrays.## Getting Started
### Prerequisites
To build and run the Kaleidoscope compiler, you will need the following tools and libraries installed on your system:
- [LLVM](https://llvm.org/) (version 16 has been used for this project.)
- [Clang](https://clang.llvm.org/) (Apple's version 15 has been used for this project.)
- [Bison parser](https://www.gnu.org/software/bison/) (version 3.8.2 has been used for this project.)
- [Flex lexer]() (version 2.6.4 has been used for this project.);### Installation
1. Modify the Makefile: change the LLVM path to the one appropriate for your system.
2. Clone the repository:```sh
git clone https://github.com/filipczuba/LEC-FE.git
cd LEC-FE
3. Run the makefile:```sh
make## Usage
To run the compiler (Use -p and -s for parsing and scanning verbose modes):```sh
./kcomp sourcefile.k 2> IRfile.ll
```Note: to run your Kaliedoscope code you'll need a C file containing Main and an extern definition of the function(s) contained in your Kaleidoscope source file.
## Licences
This project is licensed under the MIT License.