Skip to content
dslsdzcPublic

About

A programming language with semantic IR as the single source of truth, built-in formal verification, and dataflow concurrency.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

4 stars

Watchers

2 watching

Forks

Latest commit

 

History

514 Commits

Folders and files

Core Programming Language

English | 中文

self-hosted target license status

Core is an experimental programming language built around a semantic graph IR. The compiler is self-hosted, emits native x86-64 ELF directly, and keeps regions, state relations, provenance, and other program semantics through its IR instead of reducing them early to a conventional machine model.

Core's compilation model is organized around graph → lattice → encoding: computation is represented as relations first, state/storage is mapped separately, and machine representation comes last.

import io

fn fib(n: int) -> int:
    if n < 2:
        return n
    return fib(n - 1) + fib(n - 2)

fn main() -> int:
    io.println_i(fib(10))   // 55
    return 0

Core is under active development.

Features

  • Self-hosting compiler with a reproducible three-stage bootstrap
  • Native x86-64 ELF generation without an external assembler or linker
  • Semantic graph IR with explicit regions, state edges, and provenance
  • Graph → lattice → target encoding compilation model
  • Raw pointers with compile-time pointer, region, and provenance analysis
  • Arena-based memory management tied to program regions
  • Cooperative fibers and channels
  • Function-level incremental compilation through .cir snapshots
  • Hardware Interface Tables for target-specific operations
  • Generics, interfaces, enums, pattern matching, tuples, arrays, and slices
  • Specifications use Core syntax; the verification backend is still under development

Design

The graph represents computation and program relationships. The lattice layer represents state and storage mappings. Target encodings map those semantics onto a concrete execution model. Type, provenance, and specification information remains available in the semantic IR through lowering, allowing verification and optimization to operate before final target encoding.

See the Project Book, Execution Model, and Memory Model for the full design.

Status

Core is under active development and not ready for production use.

  • The bootstrap chain is stable: the compiler builds itself in three stages, and stages 2 and 3 are byte-identical.
  • The specification layer is designed but not implemented; the verification backend is a placeholder.
  • Language, standard library, and tooling gaps are tracked in TODO.md.

Building

python3 build_selfhost_native.py

This produces build/corec (frontend) and build/corearch (backend).

Usage

./build/corec run 'fn main() -> int { return 42; }'    # execute code (interpreter)
./build/corec check FILE.cr                             # type-check only
./build/corec build FILE.cr -o OUT --static             # compile to a native ELF binary
./build/corec cir FILE.cr                               # dump the dataflow graph
./build/corec ccr FILE.cr                               # dump the lattice-form IR
./build/corec clean-cache                               # clear the incremental cache

Documentation

Contributing

The project is at an early stage; design discussion and experimental implementation are welcome. See docs/ for the current design documents.

License

GNU General Public License v3.0 (with the GPLv3 §7 additional permission).

About

A programming language with semantic IR as the single source of truth, built-in formal verification, and dataflow concurrency.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

4 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages