Sere-Language/sere

The Sere programming language

4

stars

52

commits

C++

primary language

Sep 11, 2026

updated

sere-lang.com/
compiler
compiler-design
cpp
language
seeking-collaborators

README

Sere

GitHub Release GitHub Stars GitHub Forks GitHub Issues Last Commit Repository Size Discord

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.

Toolchain

ComponentVersion / location
CMake3.28+ (4.3 is fine)
Ninja1.11+
MSVCVisual Studio 2022 Build Tools, x64
LLVM22.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.

Bootstrap

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.

Linux source build

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).

Projects

.\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.

Libraries

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.

Compile a program

.\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.

ExceptionMeaning
ExceptionIgnore every diagnostic (file or line)
SyntaxErrorParse errors
IndentationErrorInconsistent indentation
NameErrorUnknown names, types, functions, macros, modules
AttributeErrorUnknown fields/methods
TypeErrorType mismatches, invalid operands, wrong arguments
IndexErrorInvalid indexing or slicing
ImportErrorMissing modules or prelude
ValueErrorValues that cannot be inferred or are invalid
AssertionErrorInvalid assert
PermissionErrorPrivate field access
RuntimeErrorControl-flow and compiler internals
RecursionErrorMacro expansion limit
NotImplementedErrorUnsupported or unexpanded constructs

Unknown names in # type[Bogus]: ignore report ValueError and list this catalog in the diagnostic help.

Language

The full reference is docs/language.md (syntax as the compiler implements it, not a roadmap).

KindExamples
Primitivesvoid, bool, i8i64, u8u64, f32, f64, str, byte, regex
PointersUnique[T], Shared[T], Ptr[T]
Collectionslist[T], array[T], dict[K, V], str indexing/slicing
User typesclass (identity), struct (copy-by-value), enum Color: with Color.Green
Controlif / elif / else, while, for, match / case, try / except / raise
Macrosmacro 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.

Editor IntelliSense

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.

Windows installer

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.

Layout

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

Documentation

Release packaging and per-user installation are documented in releases/README.md. See docs/projects.md for sectioned project configuration.

Was this made with AI

AI agents have been used strictly for error-detection, optimization opportunities, and testing. AI has no part in creative design.

Contributors

youthx

49 commits

monjaris

2 commits

Sere-Language/sere

The Sere programming language

4

stars

52

commits

C++

primary language

Sep 11, 2026

updated

sere-lang.com/
compiler
compiler-design
cpp
language
seeking-collaborators

README

Sere

GitHub Release GitHub Stars GitHub Forks GitHub Issues Last Commit Repository Size Discord

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.

Toolchain

ComponentVersion / location
CMake3.28+ (4.3 is fine)
Ninja1.11+
MSVCVisual Studio 2022 Build Tools, x64
LLVM22.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.

Bootstrap

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.

Linux source build

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).

Projects

.\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.

Libraries

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.

Compile a program

.\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.

ExceptionMeaning
ExceptionIgnore every diagnostic (file or line)
SyntaxErrorParse errors
IndentationErrorInconsistent indentation
NameErrorUnknown names, types, functions, macros, modules
AttributeErrorUnknown fields/methods
TypeErrorType mismatches, invalid operands, wrong arguments
IndexErrorInvalid indexing or slicing
ImportErrorMissing modules or prelude
ValueErrorValues that cannot be inferred or are invalid
AssertionErrorInvalid assert
PermissionErrorPrivate field access
RuntimeErrorControl-flow and compiler internals
RecursionErrorMacro expansion limit
NotImplementedErrorUnsupported or unexpanded constructs

Unknown names in # type[Bogus]: ignore report ValueError and list this catalog in the diagnostic help.

Language

The full reference is docs/language.md (syntax as the compiler implements it, not a roadmap).

KindExamples
Primitivesvoid, bool, i8i64, u8u64, f32, f64, str, byte, regex
PointersUnique[T], Shared[T], Ptr[T]
Collectionslist[T], array[T], dict[K, V], str indexing/slicing
User typesclass (identity), struct (copy-by-value), enum Color: with Color.Green
Controlif / elif / else, while, for, match / case, try / except / raise
Macrosmacro 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.

Editor IntelliSense

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.

Windows installer

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.

Layout

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

Documentation

Release packaging and per-user installation are documented in releases/README.md. See docs/projects.md for sectioned project configuration.

Was this made with AI

AI agents have been used strictly for error-detection, optimization opportunities, and testing. AI has no part in creative design.

Contributors

youthx

49 commits

monjaris

2 commits

Languages

C++

60.4%

LLVM

11.4%

C

11.1%

Python

10.6%

CMake

2.1%

PowerShell

2.0%

JavaScript

1.6%