The Sere programming language
4
stars
52
commits
C++
primary language
Sep 11, 2026
updated
Sere is a compiled typed Python superset with an LLVM 22 backend. It is not
CPython: the CPython standard library, yield/generator functions, *args, and
capturing lambdas are out of scope. Unsupported constructs diagnose (often
NotImplementedError) instead of generating silent wrong code.
Sere now has a website! Visit https://sere-lang.com/
Join the community on Discord: https://discord.gg/TRJ9nC3Bhb
def greet(name):
print(f"hello {name}")
def main() -> i32:
xs = [1, 2, 3]
xs.append(4)
greet("sere")
return 0
A typed binding may omit an initializer (ptr: Unique[i32] default-initializes). = always requires an expression.
| Component | Version / location |
|---|---|
| CMake | 3.28+ (4.3 is fine) |
| Ninja | 1.11+ |
| MSVC | Visual Studio 2022 Build Tools, x64 |
| LLVM | 22.1.8 official clang+llvm Windows MSVC archive (clang, lld, headers, libs) |
LLVM is installed to %LOCALAPPDATA%\sere\toolchains\llvm-22.1.8 so it does not live inside OneDrive.
From the repository root in PowerShell:
.\scripts\bootstrap.ps1
. .\scripts\env.ps1
cmake --preset windows-clang-cl-relwithdebinfo
cmake --build --preset windows-clang-cl-relwithdebinfo
ctest --preset windows-clang-cl-relwithdebinfo --output-on-failure
env.ps1 must be dot-sourced so MSVC vcvars64 and SERE_LLVM_DIR stay in the current session.
Use Bash on Linux x86_64 (Ubuntu 24.04 is the dependency example below). You need CMake 3.28+, Ninja 1.11+, a system C/C++ development toolchain, and the LLVM 22.1.8 development archive, including clang and lld.
sudo apt-get update
sudo apt-get install build-essential cmake ninja-build curl ca-certificates xz-utils \
zlib1g-dev libzstd-dev libxml2-dev libffi-dev libedit-dev libncurses-dev
# From the repository root, download LLVM once and build:
bash scripts/bootstrap-llvm.sh
bash scripts/build.sh
# Build and run the test suite:
bash scripts/build.sh --test
LLVM is downloaded from the official LLVM release
and installed under ${XDG_DATA_HOME:-$HOME/.local/share}/sere/toolchains/llvm-22.1.8.
Set SERE_TOOLCHAIN_ROOT to change that parent directory for both bootstrap and build.
Alternatively, set SERE_LLVM_DIR to an existing LLVM development installation;
then skip the download. Bootstrap only installs LLVM, not system packages.
On other distributions, install equivalent development packages and the required
CMake/Ninja versions using your package manager. Qt6 Widgets development packages
are optional; without them the Qt runtime is built as a stub.
For manual CMake use, source the environment in each new Bash session:
source scripts/env.sh
cmake --preset linux-clang-relwithdebinfo
cmake --build --preset linux-clang-relwithdebinfo
ctest --preset linux-clang-relwithdebinfo --output-on-failure
./build/linux-clang-relwithdebinfo/bin/sere --version
The build copies the compiler, runtime, and standard library into
build/linux-clang-relwithdebinfo/bin/ and bin/. Keep these files together.
Use a separate build directory from Windows; the Linux preset does this automatically.
For machines with limited RAM, run CMAKE_BUILD_PARALLEL_LEVEL=2 bash scripts/build.sh.
Additional configure options are accepted, for example
bash scripts/build.sh -DBUILD_TESTING=OFF (omit --test in that case).
.\bin\sere.exe init myapp
cd myapp
. .\scripts\activate.ps1
sere build
sere run
deactivate
Dot-source scripts/activate.ps1 so this terminal stays put. deactivate restores PATH and the prompt; it does not close the window. Running activate.ps1 without the leading . starts a clean nested sere shell instead.
Put the compiler on PATH from the repo or a project:
.\bin\sere-path.ps1 # this session
.\bin\sere-path.ps1 -Persistent # this session + your user PATH
sere build compiles src/main.sere; sere run builds and executes bin/<name>.exe.
sere refresh-bin copies this compiler, runtime, and stdlib into ./bin even
when the previous sere.exe is locked (it is renamed to sere.exe.old).
sere update (or sere --update) checks GitHub for the latest Windows x64
portable release, verifies its SHA-256 digest, and installs it automatically into
%LOCALAPPDATA%\Programs\Sere. Prereleases are included. Replacing a portable
asset on the same release also counts as an update: Sere records the release ID,
asset ID, modification time, and digest after successful installation. An install
without this record is refreshed once, even if its version already matches.
Unchanged assets are skipped and newer development versions are not downgraded.
The previous installation is retained beside the new one as a backup; a failed
installation restores it. Close programs using Sere if Windows blocks the rename.
sere update-local retains the previous behavior: copy this compiler into the
system installation and refresh the current project's environment. GitHub updates
install globally; existing project environments can be refreshed by running the
new global compiler with update-local from the project directory.
Automatic GitHub installation currently supports Windows x64 only.
Create a drop-in library, pack it into one .slib file, then copy that file
into another project's libs/ folder:
sere init-lib mathlib
cd mathlib
sere pack
copy dist\mathlib.slib ..\myapp\libs\
import mathlib
def main() -> i32:
return mathlib.add(2, 3)
sere --init-lib mathlib and sere init mathlib --lib do the same as
init-lib. sere pack file.sere -o mathlib.slib packs a single module
without a project. sere build in a kind = "lib" project also writes the
.slib that contains only the entry, the local modules it imports, and
compiled native objects. Unused files next to the library are not packed.
Native C/C++ under libs/native (when native = true) or loose .c / .cpp
next to a folder library is compiled and stored in that same file. If you
prefer not to pack, a folder libs/mylib/ with lib.sere or mylib.sere
plus native sources acts as the library.
.\bin\sere.exe --emit-llvm examples\hello.sere -o hello.ll
.\bin\sere.exe --emit-asm examples\hello.sere -o hello.s
.\bin\sere.exe examples\hello.sere -o hello.exe
.\hello.exe
sere finds the pinned LLVM clang/lld automatically. You only need scripts/env.ps1 when configuring or compiling the compiler itself.
sere --analyze file.sere prints JSON diagnostics. sere --lsp speaks Language Server Protocol on stdin/stdout.
Diagnostics are labeled with exception names, for example error[NameError]: unknown name 'foo'. Suppress them with comments:
# type[NameError]: ignore
def main() -> i32:
n: i32 = "nope" # TypeError still reported
return missing # NameError ignored for the whole file
def main() -> i32:
return missing # type: ignore
# type: ignore hides every diagnostic on that line. A comment-only # type: ignore on the previous line applies to the next statement. At the top of a file, # type[TypeError]: ignore or # type[Exception]: ignore applies to the whole file. # type: ignore[NameError] is accepted too.
| Exception | Meaning |
|---|---|
Exception | Ignore every diagnostic (file or line) |
SyntaxError | Parse errors |
IndentationError | Inconsistent indentation |
NameError | Unknown names, types, functions, macros, modules |
AttributeError | Unknown fields/methods |
TypeError | Type mismatches, invalid operands, wrong arguments |
IndexError | Invalid indexing or slicing |
ImportError | Missing modules or prelude |
ValueError | Values that cannot be inferred or are invalid |
AssertionError | Invalid assert |
PermissionError | Private field access |
RuntimeError | Control-flow and compiler internals |
RecursionError | Macro expansion limit |
NotImplementedError | Unsupported or unexpanded constructs |
Unknown names in # type[Bogus]: ignore report ValueError and list this catalog in the diagnostic help.
The full reference is docs/language.md (syntax as the compiler implements it, not a roadmap).
| Kind | Examples |
|---|---|
| Primitives | void, bool, i8–i64, u8–u64, f32, f64, str, byte, regex |
| Pointers | Unique[T], Shared[T], Ptr[T] |
| Collections | list[T], array[T], dict[K, V], str indexing/slicing |
| User types | class (identity), struct (copy-by-value), enum Color: with Color.Green |
| Control | if / elif / else, while, for, match / case, try / except / raise |
| Macros | macro twice(x): quote:, name!(...), indent html: raw bodies, match token-tree arms |
| Arithmetic | + - * / // % **, bitwise `& |
| Module | __name__, __file__, __package__, __doc__, __debug__, __sere_version__ |
Memory intrinsics: unique[T](value), shared[T](value), alloc[T](), load, store, free, len. print and str are intrinsics too.
alloc / free go through the installed collector (import gc). Builtins are none, mark_sweep, and arena. Custom collectors implement SereGcVTable in C, call sere_gc_install from sere_mod_init, and link with --link. Arenas and pools are in import heap.
The workspace extension in editors/vscode gives .sere files syntax highlighting, diagnostics (with exception codes such as NameError), markdown hover, completion, rename, semantic tokens, folding, and go-to-definition. It launches sere --lsp. # type: ignore and # type[NameError]: ignore suppress editor diagnostics.
Package a VSIX:
.\scripts\package-vsix.ps1
That writes dist/sere-0.2.6.vsix. In Cursor / VS Code: Extensions → … → Install from VSIX… and choose that file. Reload the window. The language server uses the RelWithDebInfo sere.exe under build/ so it does not lock ./bin/sere.exe.
Build both a portable ZIP and an offline per-user setup EXE:
.\releases\stage.ps1
# Install the extracted portable package; -Editor is optional:
.\releases\pre-0.1.5\windows-x64\install.ps1 -Editor
Outputs are in releases/pre-<version>/. LLVM and Windows linking support are
bundled; recipients need no admin access or separate development tool install.
See releases/README.md for build options and validation.
include/sere/ public compiler headers (ast, types, sema, macro, codegen, lsp)
lib/ lexer, parser, macros, type checker, LLVM codegen, driver, LSP
runtime/ heap, collectors, shared boxes, lists, print
stdlib/ prelude plus io, fs, gc, heap, random, hash, sys, and more
tools/sere/ sere executable (CLI, compiler, LSP, installer driver)
tests/ LLVM, lexer, parser, sema, macros, example emit
examples/ hello, structs, enums, strings, macros, dunders, errors, gl, introspect
build/ CMake compile tree (gitignored)
bin/ local sere.exe after a build, plus sere-path PATH helpers
dist/ vsix, zip, and installer outputs (gitignored)
editors/vscode language grammar and LSP client
scripts/ bootstrap, sere-path, project activate templates, Inno Setup helper
cmake/ LLVM discovery and warning policy
docs/ language reference plus compiler internals handbook
packaging/ Windows installer templates
releases/ packaging scripts and versioned release artifacts
Getting started: create, run, and split an application into modules.
Projects: configuration, library distribution, and troubleshooting.
Gradual typing: inference, Any, and typed boundaries.
Numeric arrays: operations, statistics, and matrix examples.
Language: docs/language.md — types, syntax, macros, stdlib surface, as implemented.
Compiler internals: docs/README.md — pipeline, libraries, how to add a keyword or module.
Patches: CONTRIBUTING.md
Release packaging and per-user installation are documented in releases/README.md. See docs/projects.md for sectioned project configuration.
AI agents have been used strictly for error-detection, optimization opportunities, and testing. AI has no part in creative design.
C++
60.4%
LLVM
11.4%
C
11.1%
Python
10.6%
CMake
2.1%
PowerShell
2.0%
JavaScript
1.6%
The Sere programming language
4
stars
52
commits
C++
primary language
Sep 11, 2026
updated
Sere is a compiled typed Python superset with an LLVM 22 backend. It is not
CPython: the CPython standard library, yield/generator functions, *args, and
capturing lambdas are out of scope. Unsupported constructs diagnose (often
NotImplementedError) instead of generating silent wrong code.
Sere now has a website! Visit https://sere-lang.com/
Join the community on Discord: https://discord.gg/TRJ9nC3Bhb
def greet(name):
print(f"hello {name}")
def main() -> i32:
xs = [1, 2, 3]
xs.append(4)
greet("sere")
return 0
A typed binding may omit an initializer (ptr: Unique[i32] default-initializes). = always requires an expression.
| Component | Version / location |
|---|---|
| CMake | 3.28+ (4.3 is fine) |
| Ninja | 1.11+ |
| MSVC | Visual Studio 2022 Build Tools, x64 |
| LLVM | 22.1.8 official clang+llvm Windows MSVC archive (clang, lld, headers, libs) |
LLVM is installed to %LOCALAPPDATA%\sere\toolchains\llvm-22.1.8 so it does not live inside OneDrive.
From the repository root in PowerShell:
.\scripts\bootstrap.ps1
. .\scripts\env.ps1
cmake --preset windows-clang-cl-relwithdebinfo
cmake --build --preset windows-clang-cl-relwithdebinfo
ctest --preset windows-clang-cl-relwithdebinfo --output-on-failure
env.ps1 must be dot-sourced so MSVC vcvars64 and SERE_LLVM_DIR stay in the current session.
Use Bash on Linux x86_64 (Ubuntu 24.04 is the dependency example below). You need CMake 3.28+, Ninja 1.11+, a system C/C++ development toolchain, and the LLVM 22.1.8 development archive, including clang and lld.
sudo apt-get update
sudo apt-get install build-essential cmake ninja-build curl ca-certificates xz-utils \
zlib1g-dev libzstd-dev libxml2-dev libffi-dev libedit-dev libncurses-dev
# From the repository root, download LLVM once and build:
bash scripts/bootstrap-llvm.sh
bash scripts/build.sh
# Build and run the test suite:
bash scripts/build.sh --test
LLVM is downloaded from the official LLVM release
and installed under ${XDG_DATA_HOME:-$HOME/.local/share}/sere/toolchains/llvm-22.1.8.
Set SERE_TOOLCHAIN_ROOT to change that parent directory for both bootstrap and build.
Alternatively, set SERE_LLVM_DIR to an existing LLVM development installation;
then skip the download. Bootstrap only installs LLVM, not system packages.
On other distributions, install equivalent development packages and the required
CMake/Ninja versions using your package manager. Qt6 Widgets development packages
are optional; without them the Qt runtime is built as a stub.
For manual CMake use, source the environment in each new Bash session:
source scripts/env.sh
cmake --preset linux-clang-relwithdebinfo
cmake --build --preset linux-clang-relwithdebinfo
ctest --preset linux-clang-relwithdebinfo --output-on-failure
./build/linux-clang-relwithdebinfo/bin/sere --version
The build copies the compiler, runtime, and standard library into
build/linux-clang-relwithdebinfo/bin/ and bin/. Keep these files together.
Use a separate build directory from Windows; the Linux preset does this automatically.
For machines with limited RAM, run CMAKE_BUILD_PARALLEL_LEVEL=2 bash scripts/build.sh.
Additional configure options are accepted, for example
bash scripts/build.sh -DBUILD_TESTING=OFF (omit --test in that case).
.\bin\sere.exe init myapp
cd myapp
. .\scripts\activate.ps1
sere build
sere run
deactivate
Dot-source scripts/activate.ps1 so this terminal stays put. deactivate restores PATH and the prompt; it does not close the window. Running activate.ps1 without the leading . starts a clean nested sere shell instead.
Put the compiler on PATH from the repo or a project:
.\bin\sere-path.ps1 # this session
.\bin\sere-path.ps1 -Persistent # this session + your user PATH
sere build compiles src/main.sere; sere run builds and executes bin/<name>.exe.
sere refresh-bin copies this compiler, runtime, and stdlib into ./bin even
when the previous sere.exe is locked (it is renamed to sere.exe.old).
sere update (or sere --update) checks GitHub for the latest Windows x64
portable release, verifies its SHA-256 digest, and installs it automatically into
%LOCALAPPDATA%\Programs\Sere. Prereleases are included. Replacing a portable
asset on the same release also counts as an update: Sere records the release ID,
asset ID, modification time, and digest after successful installation. An install
without this record is refreshed once, even if its version already matches.
Unchanged assets are skipped and newer development versions are not downgraded.
The previous installation is retained beside the new one as a backup; a failed
installation restores it. Close programs using Sere if Windows blocks the rename.
sere update-local retains the previous behavior: copy this compiler into the
system installation and refresh the current project's environment. GitHub updates
install globally; existing project environments can be refreshed by running the
new global compiler with update-local from the project directory.
Automatic GitHub installation currently supports Windows x64 only.
Create a drop-in library, pack it into one .slib file, then copy that file
into another project's libs/ folder:
sere init-lib mathlib
cd mathlib
sere pack
copy dist\mathlib.slib ..\myapp\libs\
import mathlib
def main() -> i32:
return mathlib.add(2, 3)
sere --init-lib mathlib and sere init mathlib --lib do the same as
init-lib. sere pack file.sere -o mathlib.slib packs a single module
without a project. sere build in a kind = "lib" project also writes the
.slib that contains only the entry, the local modules it imports, and
compiled native objects. Unused files next to the library are not packed.
Native C/C++ under libs/native (when native = true) or loose .c / .cpp
next to a folder library is compiled and stored in that same file. If you
prefer not to pack, a folder libs/mylib/ with lib.sere or mylib.sere
plus native sources acts as the library.
.\bin\sere.exe --emit-llvm examples\hello.sere -o hello.ll
.\bin\sere.exe --emit-asm examples\hello.sere -o hello.s
.\bin\sere.exe examples\hello.sere -o hello.exe
.\hello.exe
sere finds the pinned LLVM clang/lld automatically. You only need scripts/env.ps1 when configuring or compiling the compiler itself.
sere --analyze file.sere prints JSON diagnostics. sere --lsp speaks Language Server Protocol on stdin/stdout.
Diagnostics are labeled with exception names, for example error[NameError]: unknown name 'foo'. Suppress them with comments:
# type[NameError]: ignore
def main() -> i32:
n: i32 = "nope" # TypeError still reported
return missing # NameError ignored for the whole file
def main() -> i32:
return missing # type: ignore
# type: ignore hides every diagnostic on that line. A comment-only # type: ignore on the previous line applies to the next statement. At the top of a file, # type[TypeError]: ignore or # type[Exception]: ignore applies to the whole file. # type: ignore[NameError] is accepted too.
| Exception | Meaning |
|---|---|
Exception | Ignore every diagnostic (file or line) |
SyntaxError | Parse errors |
IndentationError | Inconsistent indentation |
NameError | Unknown names, types, functions, macros, modules |
AttributeError | Unknown fields/methods |
TypeError | Type mismatches, invalid operands, wrong arguments |
IndexError | Invalid indexing or slicing |
ImportError | Missing modules or prelude |
ValueError | Values that cannot be inferred or are invalid |
AssertionError | Invalid assert |
PermissionError | Private field access |
RuntimeError | Control-flow and compiler internals |
RecursionError | Macro expansion limit |
NotImplementedError | Unsupported or unexpanded constructs |
Unknown names in # type[Bogus]: ignore report ValueError and list this catalog in the diagnostic help.
The full reference is docs/language.md (syntax as the compiler implements it, not a roadmap).
| Kind | Examples |
|---|---|
| Primitives | void, bool, i8–i64, u8–u64, f32, f64, str, byte, regex |
| Pointers | Unique[T], Shared[T], Ptr[T] |
| Collections | list[T], array[T], dict[K, V], str indexing/slicing |
| User types | class (identity), struct (copy-by-value), enum Color: with Color.Green |
| Control | if / elif / else, while, for, match / case, try / except / raise |
| Macros | macro twice(x): quote:, name!(...), indent html: raw bodies, match token-tree arms |
| Arithmetic | + - * / // % **, bitwise `& |
| Module | __name__, __file__, __package__, __doc__, __debug__, __sere_version__ |
Memory intrinsics: unique[T](value), shared[T](value), alloc[T](), load, store, free, len. print and str are intrinsics too.
alloc / free go through the installed collector (import gc). Builtins are none, mark_sweep, and arena. Custom collectors implement SereGcVTable in C, call sere_gc_install from sere_mod_init, and link with --link. Arenas and pools are in import heap.
The workspace extension in editors/vscode gives .sere files syntax highlighting, diagnostics (with exception codes such as NameError), markdown hover, completion, rename, semantic tokens, folding, and go-to-definition. It launches sere --lsp. # type: ignore and # type[NameError]: ignore suppress editor diagnostics.
Package a VSIX:
.\scripts\package-vsix.ps1
That writes dist/sere-0.2.6.vsix. In Cursor / VS Code: Extensions → … → Install from VSIX… and choose that file. Reload the window. The language server uses the RelWithDebInfo sere.exe under build/ so it does not lock ./bin/sere.exe.
Build both a portable ZIP and an offline per-user setup EXE:
.\releases\stage.ps1
# Install the extracted portable package; -Editor is optional:
.\releases\pre-0.1.5\windows-x64\install.ps1 -Editor
Outputs are in releases/pre-<version>/. LLVM and Windows linking support are
bundled; recipients need no admin access or separate development tool install.
See releases/README.md for build options and validation.
include/sere/ public compiler headers (ast, types, sema, macro, codegen, lsp)
lib/ lexer, parser, macros, type checker, LLVM codegen, driver, LSP
runtime/ heap, collectors, shared boxes, lists, print
stdlib/ prelude plus io, fs, gc, heap, random, hash, sys, and more
tools/sere/ sere executable (CLI, compiler, LSP, installer driver)
tests/ LLVM, lexer, parser, sema, macros, example emit
examples/ hello, structs, enums, strings, macros, dunders, errors, gl, introspect
build/ CMake compile tree (gitignored)
bin/ local sere.exe after a build, plus sere-path PATH helpers
dist/ vsix, zip, and installer outputs (gitignored)
editors/vscode language grammar and LSP client
scripts/ bootstrap, sere-path, project activate templates, Inno Setup helper
cmake/ LLVM discovery and warning policy
docs/ language reference plus compiler internals handbook
packaging/ Windows installer templates
releases/ packaging scripts and versioned release artifacts
Getting started: create, run, and split an application into modules.
Projects: configuration, library distribution, and troubleshooting.
Gradual typing: inference, Any, and typed boundaries.
Numeric arrays: operations, statistics, and matrix examples.
Language: docs/language.md — types, syntax, macros, stdlib surface, as implemented.
Compiler internals: docs/README.md — pipeline, libraries, how to add a keyword or module.
Patches: CONTRIBUTING.md
Release packaging and per-user installation are documented in releases/README.md. See docs/projects.md for sectioned project configuration.
AI agents have been used strictly for error-detection, optimization opportunities, and testing. AI has no part in creative design.
C++
60.4%
LLVM
11.4%
C
11.1%
Python
10.6%
CMake
2.1%
PowerShell
2.0%
JavaScript
1.6%