Creating a new project

Creating a basic Hello, World! program

Once you have the CaffeineC compiler installed, we can continue by making our first project. Open up a command line and paste in

CaffeineC --version

to verify that the compiler has been installed correctly.

Once we have verified the functionality of the compiler, either open up a new command line in the folder where you want to create the project, or use the cd command to move to it. Then run the following command and replace projectname with the name of your project.

CaffeineC init projectname

The compiler will ask you a series of questions about the project. When it is done, you will be left with a new folder which will contain a cfconf.yaml that looks something like this:

name: NewProject
description: A new CaffeineC project
version: 1.0.0
main: src/main.cffc
dependencies: []
author: Anonymous
license: MIT

and a src/ folder with a main.cffc file in it. This file should contain a starter program that looks like this:

package main;

extern func printf(format: *i8): void;

func main(): i64 {
    printf("Hello, world!\n");
    return 0;
}

To run the program, simply move into the project's root direcotry and type:

CaffeineC run

Last updated