Getting Started

Installation

1. Install Type-V

Prerequisite:

MacOS:

Ubuntu:

On ubuntu you need to add the following compiler directive to the CMakeLists.txt file in the root type-v directory:

The reason for this, is the VM using C11 features such as aligned_alloc and strdup. This will be replace with mi_malloc soon enough, but for now, they cause sanitizers errors so i had it off.

clang is recommended over gcc as the performance gains tested on Linux are significant.

Windows:

Untested.

Postrequisite:

Export the path to the type-v folder as TYPE_V_PATH in your environment.

2: Install Type-C

You can now use the typec command in your terminal. Type typec --help for more information.

When you run typec init <folder> it will automatically check for updates for the standard library and create a new project in the folder with a module.json file and a main.tc file.

Remember you need to have both TYPE_V_PATH exported in your environment.

Creating a Project

Use CLI:

If you have installed the CLI, you can create a new project with the following command:

This will create the folder if needed, and create a module.json and main.tc files in the folder.

Manual:

To create a new project, we will need to create a new folder, and create a module.json file. This file contains the project compiler settings, dependencies, search path, etc.

As for now, only the compiler.entry field is used. This field specifies the entry point of the project.

Running the project:

First compiling the project with type-c compiler: node outs/index.js -c [path-to-module.json folder] -o [output-directory] Then run the output with the type-v virtual machine: ./type-v [output-directory]/bin.tvb [output-directory]/src_map.map.txt

The src_map.map.txt file is generated by the compiler and contains the source map to be able to trace crashes.


Kudos! Keep reading!