Skip to content

Togira123/insult-lang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

INSULT - Incredibly Nasty Script Unleashing Literal Tantrums

Compiling

Prerequisites

To compile the compiler you need the following packages:

  • g++

    Check if it is installed with

    g++ version

    and if not installed, install with

    xcode-select --install

    This should install g++ to /usr/bin/g++ which is where cmake expects it to be. Make sure this is the case.

    This will install tons of useful packages, including g++.

  • make

    Check if it is installed with

    make --version

    and otherwise install with

    xcode-select --install

    This will install tons of useful packages, including make.

  • cmake

    Check if it is installed with

    cmake --version

    and otherwise install with

    brew install cmake

    (In case brew is not installed on your computer you can install it following the instructions here)

Compile

To compile first create a directory named build in the root and then run

cd build && cmake .. && make

This will create an executable named inslt.

Running

After compiling make sure you are in the build directory. Use ./inslt to run the executable. It takes one argument which is the name of the file to compile. For example you can run

./inslt ../tests/fibonacci.inslt

to compile the file fibonacci.inslt located in the tests directory. The resulting file will have the default name a.out. That file can now be run with ./a.out.

Compiler flags

There are a few compiler flags which can be used to enable/disable certain features the compiler can offer. To use them just append them to the input file name, separated by spaces. Below is a list of all the currently available flags.

  • -optimize

    Using this flag will tell the compiler to perform some optimization steps in order to make the resulting executable run faster and use up less memory. Omitting this flag will not prevent the compiler from performing some minor changes to the input.

  • -out <name>

    This flag can be used to set the name of the output file. This defaults to a.out. Set the name without the angle brackets.

  • -forbid_library_names

    This flag forbids names of the standard library being used to define identifiers.

  • -emit_cpp

    This flag emits the generated C++ code