cint university / ced, the cint editor
set up cint on your computer
Every program in cint university runs in your browser at integerc.dev, with nothing to install. This page sets up the other way: cint on your own computer, an editor to write programs in and a terminal to run them.
You need three things:
- Python 3.12 or later. The build scripts are written in Python.
- A C compiler. cint turns your program into C, then uses this compiler to build it. On Windows that is Microsoft's C compiler (MSVC), on macOS it is Apple Clang and on Linux it is GCC or Clang.
- The cint source, downloaded from {{SOURCE_URL}} and unpacked into a folder.
build cint
Pick the steps for your system. Each one ends with the cint command and its debugging tools in a folder called cint in your home folder.
Windows
- Install Python from python.org. On the installer's first screen, select Add python.exe to PATH.
- Install Build Tools for Visual Studio from visualstudio.microsoft.com. In the installer, choose the workload Desktop development with C++.
- In File Explorer, right-click the folder where you unpacked cint and choose Open in Terminal. Then run these two commands:
text
python tools\cint_bootstrap.py --leg msvc --out "$HOME\cint"
python tools\cint_tools.py --leg msvc --out "$HOME\cint"
- Add the new folder to your PATH, so that
cintworks from any folder. Open the Start menu and search for Edit environment variables for your account. Select Path and choose Edit, then New. Type the folder's full path, for exampleC:\Users\ada\cint, then close and reopen any open terminals.
The build finds the C compiler on its own. You do not need a "Developer Command Prompt".
macOS
- Open Terminal and install Apple's command line tools, which include Apple Clang:
text
xcode-select --install
- Install Python 3.12 or later from python.org. The command line tools include an older Python that is too old for the build.
- In Terminal, go to the folder where you unpacked cint and run these two commands:
text
python3 tools/cint_bootstrap.py --leg apple-clang --out ~/cint
python3 tools/cint_tools.py --leg apple-clang --out ~/cint
- Add the folder to your PATH, then open a new Terminal window:
text
echo 'export PATH="$HOME/cint:$PATH"' >> ~/.zprofile
Linux
These commands are for Ubuntu 24.04 or later and Debian 13 or later; older releases come with a Python older than 3.12. Other distributions have the same packages under similar names.
- Install the compiler and Python:
text
sudo apt install gcc python3
- Go to the folder where you unpacked cint and run these two commands:
text
python3 tools/cint_bootstrap.py --leg gcc --out ~/cint
python3 tools/cint_tools.py --leg gcc --out ~/cint
- Add the folder to your PATH, then open a new terminal:
text
echo 'export PATH="$HOME/cint:$PATH"' >> ~/.bashrc
The first command builds cint. It runs in three steps and prints a line for each. First, a small compiler written in C is built. That compiler translates the cint compiler, which is written in cint, into C. Then your C compiler builds that C into the cint command.
The second command builds five debugging tools into the same folder. Each one runs as a cint command:
cint workbenchopens an interactive session that can rewind a run.cint replopens the same session.cint debuglocates, replays and compares faults.cint explainshows what the compiler knows about each function.cint interpis the interpreter, which runs a program without a C compiler.
Timed once by the wall clock, on a four-core Intel Xeon at 2.10 GHz running Ubuntu 24.04 with GCC 13.3, the first command took 45 seconds and the second 36 seconds.
write and run a program in VS Code
VS Code is a free editor for Windows, macOS and Linux, and it is the editor these lessons use in their steps.
- Install VS Code and open it.
- Choose File > Open Folder, make a new folder called
cint-programsand open it. - Choose File > New File, name it
hello.ciand type:
ci
"Hello, world\n";
Save it with Ctrl+S (Cmd+S on macOS). 4. Choose Terminal > New Terminal. A terminal opens at the bottom of the window, already in your folder. Type:
text
cint run hello.ci
and press Enter. The terminal prints:
text
Hello, world
If the terminal says it cannot find cint, close VS Code and open it again, so that it reads the new PATH.
color for cint programs
VS Code does not know cint, but cint looks enough like C that C's colors fit most of a program: comments, text in quotes, numbers and words such as if, for and return. Type names such as I64 stay uncolored. To turn this on, open the Command Palette (Ctrl+Shift+P, or Cmd+Shift+P on macOS), choose Preferences: Open User Settings (JSON) and add this line inside the outer braces:
"files.associations": { "*.ci": "c" }
run with one key
You can make Ctrl+Shift+B (Cmd+Shift+B on macOS) run whatever file is open. In your cint-programs folder, make a folder called .vscode and in it a file called tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"label": "cint run",
"type": "shell",
"command": "cint",
"args": ["run", "${file}"],
"group": { "kind": "build", "isDefault": true },
"problemMatcher": {
"source": "cint",
"severity": "error",
"fileLocation": ["relative", "${fileDirname}"],
"pattern": [
{ "regexp": "^(error|fault)\\[(\\w+)\\]: (.*)$", "code": 2, "message": 3 },
{ "regexp": "^\\s+--> (.*):(\\d+):(\\d+)$", "file": 1, "line": 2, "column": 3 }
]
}
}
]
}
The problemMatcher part reads cint's messages. When a program has an error or stops with a fault, VS Code underlines the line and lists it in the Problems panel. Click the entry to jump to the line.
or use a text editor and a terminal
If you would rather not use VS Code, any plain text editor and a terminal will do. Programs were written this way long before editors had buttons. You type the program into a file and hand the file to the compiler, as programmers once did on teletypes, typewriters wired to a computer.
- Open a plain text editor:
- Windows: Notepad.
- macOS: TextEdit. Choose Format > Make Plain Text and turn off Edit > Substitutions > Smart Quotes. Or use
nanoin Terminal. - Linux: your desktop's Text Editor, ornanoin a terminal. - Type the program:
ci
"Hello, world\n";
- Save it as
hello.ciin a folder of your own. In Notepad, set Save as type to All files so the name does not becomehello.ci.txt. Set Encoding to UTF-8. - Open a terminal, go to that folder with
cdand run:
text
cint run hello.ci
Two editor settings cause trouble. Curly quotes, which some editors put in place of straight ones as you type, are not quotes to cint:
error[C1013]: invalid name
--> hello.ci:1:1
A file saved as "UTF-8 with BOM" starts with three invisible bytes that cint refuses:
error[C1002]: invalid source bytes
--> hello.ci:1:1
Either message on the first line of a file you just typed means the editor changed what you typed. Fix the setting and save the file again.
what you have now
cint run FILE.cibuilds a program and runs it.cint test FILE.ciruns the tests in a file.cint build FILE.ciwrites a program you can run without cint, into a folder calledbuildnext to the file.cint emit-c --root DIR --out DIR FILE.ciwrites the C that cint makes from your program.
Each lesson tells you which of these it uses.