Skip to content

C++ based copiler for LLVM's Kaleidoscope language.

License

Notifications You must be signed in to change notification settings

filipczuba/LEC-FE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kaleidoscope Compiler

This repository contains an implementation of the Kaleidoscope language, a simple language introduced in the LLVM Tutorial. This project has been made for the Compilers course held at the University of Modena and Reggio Emilia.

Table of Contents

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 (version 16 has been used for this project.)
  • Clang (Apple's version 15 has been used for this project.)
  • Bison parser (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:

    git clone https://github.com/filipczuba/LEC-FE.git
    cd LEC-FE
  3. Run the makefile:

    make
    

Usage

To run the compiler (Use -p and -s for parsing and scanning verbose modes):

./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.

About

C++ based copiler for LLVM's Kaleidoscope language.

Resources

License

Stars

Watchers

Forks