r/Protos • • 1d ago

What happens when a programming language exposes its own parser as a standard library?

Protos, an experimental prototype-based programming language running on GraalVM and Truffle, now exposes its own Protos-written lexer, highlighter and parser directly through its standard library.

Lexer: import("std:source/lexer")
Highlight: import("std:source/highlight")
Parser: import("std:source/parser")

Inspired by the reflective traditions of Smalltalk, Self and Lisp, I'm interested in making language implementation facilities accessible to ordinary applications rather than hiding them inside the compiler.

The source-analysis library provides:

  • Lossless tokenization with Unicode 17 support.
  • Syntax highlighting with error recovery.
  • Parsing into a source-level AST.
  • Exact source positions and configurable resource limits.
  • Analysis without executing the input code.

All 149 conformance tests pass, with no new production Java code.

The next milestone is replacing the existing Java frontend with the Protos-written implementation.

For those working on programming languages: do you think lexers and parsers should be standard library facilities?

https://github.com/guillermomolina/protos

1 Upvotes

0 comments sorted by