Skip to content

nao1215/bosse-toolchain

Repository files navigation

bosse-toolchain

Note

This project is currently under active development. Nothing here yet: I've only finalized the specification and just started development.

bosse-toolchain is a small-scale learning project written in OCaml, planned to provide:

  • Compiler(bossecc) for a minimal C(Go)-style teaching language
  • Virtual Machine(bossevm) to execute the compiled bytecode
  • Bytecode Disassembler (bosse-disasm) for inspecting compiled bytecode
  • AST Visualizer/Dump (bosse-ast) for debugging parser output
  • Code Formatter (bosse-fmt) for enforcing style and readability
  • Interactive REPL (bosse-repl) for live code experimentation and learning

🎯 Purpose

I built Bosse as a lean, hands‑on exercise to understand:

  • How a C‑style language front‑end (lexer, parser, type checker) flows into
  • A simple bytecode representation, and then
  • How that bytecode is executed by a minimal VM

By keeping the language spec tiny and splitting compiler and VM, I forced myself to master each phase in isolation—no black‑box magic, no hidden runtime.

Beyond these core components, I also aim to implement a full modern language ecosystem—formatters, analyzers, interactive REPLs—to truly appreciate how challenging it is to build a real programming language from scratch. Although the core language remains small, implementing these complementary tools reveals the true scope and complexity of modern language ecosystems.


✨ Language Features

Bosse is a minimal C(Go)-style teaching language designed to be simple yet expressive enough for basic algorithms. It includes:

  • Scalar types only: 32-bit signed integers and booleans
  • Basic control flow: if...else, while, and return
  • Global functions: simple declarations, no nested scopes or closures
  • Single data structure: value‑only arrays (a[i], len(a))
  • Minimal I/O: print_int, read_int for CLI programs
  • Deterministic execution: no exceptions, runtime errors abort with an exit code
  • Simple parsing: LL(1)/recursive‑descent grammar—no surprises

This trimmed‑down feature set means you can write algorithms (sorting, recursion, simulations) but nothing more elaborate—exactly by design. Bosse language specification is documented in doc/language_specification.md.


🐣 Name Origin

I toyed with “Hump” since OCaml’s mascot is a camel—but discovered “hump” has… other connotations in English slang, so I went with Bosse (French for “hump”) to keep the camel motif while avoiding awkward misunderstandings.


LICENSE

This project is licensed under the MIT License.


🦾 Future Plan

When this project is complete, I plan to publish my learnings as a Japanese technical doujinshi. Your support truly motivates me—I'd be very grateful for a GitHub Star or sponsorship at https://github.com/sponsors/nao1215.

About

toy virtual machine and compiler in OCaml

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published