Skip to content

ZOrfeas/Llama-Compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Llama language compiler

E.C.E. - N.T.U.A. Compilers class semester project

Implementation of a compiler for the functional programming language Llama

Supported features

most if not all of what is specified here
some worth mentioning are:

  • User defined types
  • Structural equality
  • Type inference
  • Function closures
  • Garbage collection
  • Floating point arithmetic
  • Optimizations
  • Modular execution

Example commands

./llamac -help # produces a help message
./llamac [llama-source-file] # optionally can add -o [executable-file-name] 
./llamac [llama-source-file] -i -o [llvm-IR-file-name] -frontend compile # produces IR source file
./llamac [llama-source-file] -S -o [assembly-file-name] -frontend compile # produces assembly source file
./llamac [llama-source-file] -ast -frontend syntax -o [ast-output-file-name]
./llamac [llama-source-file] -idtypes -frontend inf # prints inferred type information

Build

make to create a production version
(clang required to fully produce executable, else stops at object file)

Dependency installation tips
  • sudo apt install nasm necessary for library compilation

  • libgc build from source for garbage collection (can be disabled in makefile) Build summary:

    git clone git://github.com/ivmai/bdwgc.git
    cd bdwgc
    git clone git://github.com/ivmai/libatomic_ops.git
    ./autogen.sh
    ./configure
    make -j
    make check
    make install
  • Bison build from source:

    wget http://ftp.gnu.org/gnu/bison/bison-3.7.6.tar.gz
    tar -zxvf bison-3.7.6.tar.gz
    cd bison-3.7.6/
    sudo ./configure
    sudo make
    sudo make install
    # sudo ln -s /usr/local/bin/bison /usr/bin/bison # (possibly necessary)
  • sudo apt install flex should be enough

  • LLVM Install precompiled binaries source

    wget [proper-tarball-url]
    sudo tar -xf [tarbal name].tar.xz --strip-components=1 -C [install-dir]
    export PATH=$PATH:[install-dir]/bin
    cd [install-dir]
    sudo echo [install-dir]/lib >> /etc/ld.so.conf.d/libs.conf # make sure it's in a new line
    sudo ldconfig

    check installation with llvm-config --version

  • Build garbage collector from source more docs

Built with

Component Tools
Lexer Flex v2.6.4
Parser Bison v3.7.6
Semantic analysis C++11
Backend LLVM v10.0.0

Authors

Other Dependencies

Sources

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published