Code Monkey home page Code Monkey logo

lcc's Introduction

lcc: A Based Of LLVM C Compiler

This is the source code Tutorial. Lcc is based llvm c99 compiler. You can click this to visit my video and this compiler tutorial.

This project will implement almost all ISO C99 syntax and can work on Windows, Linux and Mac OS X.

ISO C 99 Doc link (pdf file): C99

Current Status:

Module Status
Preprocess working...
Lexer 100%
Parser 99.99%
Semantics working...
CodeGen working...

Test Status:

catch2 will be integrated in the future

Compile and Run

Install the latest LLVM library or Build LLVM manually

一:Install the latest LLVM library

Mac:
----------------------
1, install homebrew 
reference: https://brew.sh/
or reference: https://brew.idayer.com/

2, brew install llvm

Linux:
----------------------
1, sudo apt-get update
2, sudo apt-get -y install llvm-12

Windows:
----------------------
reference:  https://blog.csdn.net/kingfox/article/details/117450533

二:Build LLVM manually

git clone https://github.com/llvm/llvm-project.git
cd llvm-project/llvm  && mkdir llvm_install_dir && mkdir build
cd build
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../llvm_install_dir ../llvm

How to use lcc

一:Compile

1, git clone [email protected]:iiicp/lcc.git
2, cd lcc && mkdir build && cd build 
3, cmake -GNinja -DLLVM_DIR="Path to Your LLVM CMake dir" ..
4, ninja 

二:Run

lcc support --dumpTokens and --dumpAst command line options

./lcc --help
./lcc --dumpTokens ../tests/c/stmt.c
./lcc --dumpAst ../tests/c/stmt.c 

lcc unsupported c99 language features

  1. unicode char
  2. _Complex
  3. direct-declarator ( identifier-list{opt} )
    eg: int f(a, b) int a,b {return a+b;}

lcc develop history

Reference

lcc's People

Contributors

iiicp avatar zhonglingxiao avatar

Watchers

James Cloos 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.