Racket for Hydroper Jet?

I've spent a little time formulating compilation units for the Hydroper Jet Language using the Rust language. However, I'm not sure whether it's worthy continuing ahead to build a handwritten parser.

What I want to do is develop two things with the Jet Compiler:

  • Bytecode generation. Transpilation to other languages is possible in tools that read the generated bytecode. Plain meta data may be attached to Jet definitions in the bytecode, allowing for special treatment of such.
  • Package management. The Jet Language should be embedded with a package manager.
  • API documentation compiler. HTML documentation generation should be possible with the Jet Compiler.

The basic challenges of parsing the Hydroper Jet are the lexical input goals: it has 4 input goals because the syntax derives productions and nonterminals from the legacy E4X (ECMAScript for XML).

I'm excited to try implementing a parser and have done several handwritten parsers for different dialects (or predecessors) of my Jet Language in the past, but given that I've never tolerated parsing errors, I'd like to try using a facility to help me building a parser more efficiently.

I've seen that Racket allows you to define language readers and it has a rich package ecosystem including cryptography (which may be important for JetPM), however I'll confess I didn't try Racket yet and I'm not understanding the language reader example yet (I'm not good at Lisp/Scheme).

If you've any suggestions of what I should do, I appreciate!

If your actual implementation will be in Rust anyway, I don't think a Racket parser is the right choice at all. Racket doesn't exceptionally do anything better than other languages regarding parsing. What we do really well is providing tools to compile your language into Racket, to reuse its facilities. But since you are not gonna do that anyway, I think it's pointless to use Racket for your work. Especially since you have to somehow transfer the parsed tree in Racket to Rust, which is going to be a headache (probably more than just implementing a parser in Rust in the first place).

There are many Rust parser generators. I would try them and then pick one.

3 Likes

Understood, I'll keep going on Rust then!