Let's write a compiler, part 3: A parser

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • pl0c

    Self-hosting PL/0 to C compiler to teach basic compiler construction from a practical, hands-on perspective.

  • > Using the character constants in the code as in expect('+') or whatever is clearer.

    That's not how it works, TOK_* represent whole elements, the element may happen to be a single character, but it can be a word. It would be highly confusing to pass single characters to expect() as you wouldn't know at first sight whether it expects a simple character or an element. The TOK_* could as well be assigned a random number as you say in your following sentence. And they were until yesterday :-) I guess it is easier to debug with mnemonic characters.

    https://github.com/ibara/pl0c/commit/aba92627deac3f8cfe08679...

  • swifties

    a custom language construction kit

  • What few seem to realize is that it's perfectly possible to abstract out some of the work and create an extensible foundation for manual parsers.

    Since it's all regular code, you can use the full power of the host language to deal with the problem.

    https://github.com/codr7/swifties/blob/main/Sources/Swifties...

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • FLOX

    An adaptation of the interpreter from the book 'Crafting Interpreters' by Robert Nystrom written in F# (by BazookaMusic)

  • The code isn't perfect, it's a learning project and still WIP, but you can check the code for a parser for the LOX language ( c-like) from 'Crafting Interpreters' in this project. 'Ast.fs' and 'Parser.fs' should be enough to get an idea of what it's doing.You can also google the grammar of the language which is quite simple:

    https://github.com/BazookaMusic/FLOX

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts