Giter Site home page Giter Site logo

koukyosyumei / mycompiler Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 11.18 MB

Toy compiler from a simple language to LLVM-IR implemented from scratch in Haskell

License: Apache License 2.0

Haskell 93.67% Shell 0.23% LLVM 6.10%
compilier llvm llvm-ir

mycompiler's Introduction

MyCompilier

This project implements a compiler that translates code from a simple language into LLVM IR. This project is inspiered by Kaleidoscope.

What it does:

  • Takes source code as input and breaks it down into its building blocks (identifiers, numbers, expressions) using a lexer and parser.
  • Generates LLVM IR that represents the functionality of the source code. This code can then be compiled and run by an LLVM toolchain.

What it can do:

  • Handles basic expressions involving arithmetic operations (addition, multiplication, comparison).
  • Supports function definitions with arguments and function calls.
  • Generates code for conditional statements (if statements)

Examples

./main "def main() if 4<3 then 12 else 13;" | lli; echo $?

mycompiler's People

Contributors

koukyosyumei avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.