Skip to main content

TosinLang Compiler (Tocin)

A statically-typed systems programming language targeting LLVM IR with goroutine-style concurrency, NUMA-aware scheduling, and V8 JavaScript integration. Built from scratch with custom Lexer, Parser, and Semantic Analyzer.

Visit website
  • Language Designer
  • Compiler Engineer
  • LLVM Backend Developer
  • Systems Architect
Tocin programming language code showcasing work-stealing scheduler and trait-based polymorphism

The problem

Modern systems programming languages force developers to choose between safety and performance, or between high-level abstractions and low-level control. Existing languages lack integrated concurrency models that scale to millions of lightweight tasks while maintaining NUMA-awareness and memory safety. Furthermore, bridging systems programming with JavaScript ecosystems remains cumbersome, requiring extensive FFI boilerplate.

The solution

Tocin is a statically-typed systems programming language that targets LLVM IR, combining goroutine-style concurrency with NUMA-aware scheduling and V8 JavaScript integration. The language features fiber-based execution with 4KB stacks supporting millions of concurrent goroutines, a work-stealing scheduler with 5-level priority queues, and trait-based polymorphism.

Key language features include comprehensive null safety, LINQ-style collections, automatic memory management with optional manual control, and seamless JavaScript interop via V8. The compiler produces optimized native code via LLVM 11.0+, achieving near-C performance while maintaining expressive, modern syntax.

Technical implementation

The Tocin compiler is implemented in C++17 with extensive use of modern language features. The architecture consists of a custom lexer, recursive descent parser, semantic analyzer with type inference, and LLVM IR code generator. The runtime includes a sophisticated work-stealing scheduler inspired by Go's goroutine model.

Key components of the implementation include:

  • Custom Lexer, Parser, and Semantic Analyzer pipeline
  • Fiber-based execution with 4KB stacks (millions of goroutines)
  • Work-stealing scheduler with 5-level priority queues
  • NUMA-aware memory scheduling for multi-socket systems
  • V8 JavaScript engine integration for seamless interop
  • Trait-based polymorphism and LINQ-style collections
  • LLVM 11.0+ backend producing optimized native code

Outcomes & impact

Building a production compiler from scratch is work typically requiring a senior/staff engineer with 8+ years of experience. The project demonstrates deep expertise in compiler theory, language design, and systems programming — from lexical analysis through LLVM code generation.

The Tocin compiler serves as both a practical systems programming tool and a demonstration of advanced computer science concepts. The concurrent runtime has been benchmarked to handle millions of lightweight fibers efficiently, and the NUMA-aware scheduler shows significant performance improvements on multi-socket systems.

Future developments

The roadmap for Tocin includes enhancing concurrency support with a task-based async model, implementing more advanced compilation optimizations, and expanding the standard library with additional modules for web development, scientific computing, and systems programming. We're also developing interactive development environments and better debugging tools to make the language even more accessible to beginners while maintaining its power for advanced users.