DEV Community

Cover image for Tyrus - TypeScript syntax. Rust semantics.
TitenQ
TitenQ

Posted on

Tyrus - TypeScript syntax. Rust semantics.

Four months ago, I got curious about building my own programming language.

All I wanted was for it to be written in Rust and compiled to native code. My initial goal was simply to print "Hello World" in the terminal. I pulled it off, and from there, I kept adding more features.

I knew absolutely nothing about compilers when I started. Along the way, I discovered a whole new world of concepts: parsing, semantic analysis, AST, ASan, LSan, UB, LLVM, IR, drop glue, double free, LSP, and so on.

Today, I feel like I know maybe 5% of it. Now it's time to fix all the bugs that will inevitably show up.

So I created Tyrus: TypeScript syntax. Rust semantics.

What is already implemented:

  • Lexer, parser, and AST
  • Type checker with inference and generics
  • Borrow checker with NLL
  • LLVM codegen
  • REPL with JIT
  • Async functions, async/await, and task management
  • Arrays, tuples, Map, Set, and collection methods
  • Option/Result, comptime, defer/errdefer, exhaustive pattern matching, and pipe operator
  • Validator Decorations
  • Automated tests and a CLI to create, check, build, run, and watch projects
  • LSP for VS Code, Neovim, Zed, Kate, and IntelliJ/WebStorm
  • WASM playground
  • Native modules: fs, os, net, http, process, temporal, crypto, algorithm, archive, compress, db, encoding, stream, task, and others

https://tyruslang.org

What feature would you implement if you were building your own programming language?

Top comments (0)