Giter Site home page Giter Site logo

a-gafiyatullin / coolc Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 7.76 MB

🤓 Cool PL compiler

License: MIT License

Shell 2.11% Cool 9.67% C 1.26% C++ 85.70% CMake 1.15% Dockerfile 0.11%
coolc cool compiler compilers gc llvm garbage-collector runtime statepoint shadow-stack

coolc's Introduction

The COOL Programming Language Compiler

This directory and its subdirectories contain source code for coolc, the compiler for Classroom Object Oriented Language created for educational purposes by Alexander Aiken.

Please see the documentation provided in docs/ for further assistance with coolc.

Getting the Source Code and Building COOLC

  1. Checkout COOLC:

    • git clone https://github.com/a-gafiyatullin/coolc.git
  2. Configure and build COOLC:

    • Prerequirements:
      • clang-14;
      • gtest;
      • boost-1.61;
      • llvm-14;
      • You can use VS Code and Dev Containers extension to get Ubuntu 22.04 which contains these packages.
    • build.sh [-release/-debug] [options]
      Some useful options:
      • -clean --- clean build directory before compilation.
      • -asan --- build with AddressSanitizer (debug only).
      • -ubsan --- build with UndefinedBehaviorSanitizer (debug only).
      • -test --- run tests after building.
      • -mips --- build for SPIM emulator.
      • -llvm --- build with LLVM for host architecture.
      • -shadow-stack-gc --- (llvm build) build with LLVM Shadow Stack.
      • -statepoint-example-gc --- (llvm build) build with LLVM Stack Maps. (default)
      • -no-gc --- (llvm build) build without GC (ZeroGC only).
  3. Some useful runtime options for LLVM-based build with GC (pass them as argument to executable):

    1. MaxHeapSize --- maximal heap size (e.g. MaxHeapSize=1024[Gb/Mb/Kb/no specifier for bytes]).
    2. GCAlgo --- GC algorithm (e.g. GCAlgo=1):
      1. ZeroGC (code 0) --- just allocate memory without collecting.
      2. MarkSweepGC (code 1) --- use Mark-and-Sweep GC.
      3. ThreadedCompactionGC (code 2) --- use Jonkers's threaded compaction (Mark-and-Compact) GC (default).
      4. CompressorGC (code 3) --- use Kermany and Petrank's compressor (Mark-and-Compact) GC.
      5. SemispaceCopyingGC (code 4) --- use Semispace Copying GC (Copying) GC.
    3. PrintGCStatistics --- print some statistics about GC (e.g. +PrintGCStatistics);
    4. DoOpts --- do custom optimizations:
      1. NCE --- Null Check Elimination;
      2. DAE --- Dead Allocation Elimination (in pair with GVN).
  4. Note, that executables, that were generated by coolc, require runtime library (libcool-rt.so):

    1. This library is located in bin folder with coolc;
    2. You have to add it to your LD_LIBRARY_PATH;
    3. The easiest way to do it is to build compiler with command source ./build.sh

coolc's People

Contributors

a-gafiyatullin avatar

Stargazers

Andrew Johnson avatar Victor Borges avatar

Watchers

Dmitry Bezhetskov avatar  avatar  avatar

Forkers

gmh5225

coolc's Issues

Комментарии по semant

Почему бы не вынести класс Scope в отдельный файл?
https://github.com/gafiyatullin-a/Compilers/blob/da6b673f9d5a7e72c02b19a6f744dab5ac503850/Compilers-Alex-Aiken/include/semant/Semant.h#L28
2.
Можем ли эту константу определить как constexpr и в .cpp файле и не светить её на уровне класса?
https://github.com/gafiyatullin-a/Compilers/blob/da6b673f9d5a7e72c02b19a6f744dab5ac503850/Compilers-Alex-Aiken/include/semant/Semant.h#L34
3.
Если нам больше потом этот vector не нужен, тогда может мы его mov'нем внутрь Semant?
https://github.com/gafiyatullin-a/Compilers/blob/da6b673f9d5a7e72c02b19a6f744dab5ac503850/Compilers-Alex-Aiken/include/semant/Semant.h#L157
4.
Не проше ли оставить один add который всегда возвращает ваш ADD_RESULT?
https://github.com/gafiyatullin-a/Compilers/blob/da6b673f9d5a7e72c02b19a6f744dab5ac503850/Compilers-Alex-Aiken/include/semant/Semant.h#L46

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.