hypotenuse command, and run it on your machine. By the end, you will have a working development loop and a clear picture of how a C△ source file is structured. If you have not installed the compiler yet, start with the Installation Guide first.
Write Your First Program
Create a new file calledhello.ctri and add the following code.
hello.ctri
Compile and Run
1
Save the file
Make sure the file is saved as
hello.ctri in your current working directory. C△ source files always use the .ctri extension.2
Compile to an executable
Run the following command to compile The
hello.ctri into a native binary.-c flag tells the compiler to invoke GCC after code generation and produce a linked executable. If you omit-c, the compiler prints the intermediate C output to stdout instead of producing a binary. The output binary is named hello in the current directory.3
Run the executable
Execute the binary directly.You should see the following output in your terminal.
Understanding the Code
Here is what each part ofhello.ctri does.
using <plstd>;— imports the C△ standard library. Angle-bracket imports search the systemPLIBS/directory that was set up during installation. You can also import individual symbols withusing printd from <plstd>;if you want to keep the namespace minimal.int main()— the program entry point, identical in signature to standard C. The compiler expectsmainto return anint. A return value of0signals success to the operating system.printd@lib("Hello, C△!")— a type-aware print function provided byplstd.printdinspects the type of its argument at compile time and emits the appropriate output routine so that you can pass strings, integers, floats, or other types without format strings.- Be aware that the compiler will verify whether a library function has been properly globalized or referenced. Check if you used your ”@” properly.
A More Complete Example
The program below introduces three additional features: thestring type, the dynam dynamic array, and the len function.
example.ctri
stringis a first-class C△ type. It holds a heap-allocated character sequence and handles duplication and freeing automatically when you reassign or reuse the variable.dynam int scoresdeclares a dynamic array of integers, initialised with an inline list literal. You can grow it at runtime or pass it to any function that accepts an array.len(scores)returns the number of elements in adynamarray (or the byte length of astring). It is provided byplstdand works across collection types.printfsis a formatted print function that uses{variable}interpolation syntax instead of C-style%d/%sformat specifiers.
Next Steps
Language Guide
Explore the full C△ syntax: control flow, functions, structs, lambdas, inline assembly, and the namespace system.
Standard Library
Browse the
plstd modules — printd, printfs, string operations, file I/O, and more.Keywords Reference
A complete list of every C△ keyword and operator with descriptions and usage examples.
CLI Reference
All
hypotenuse command-line flags, from compiling and debugging to installing .plib libraries.