You need to distinguish different types of implementations:
1. An interpreter is a function that consumes a representation of your (J)
program and determines its value (and output, if any).
2. A compiler is a function that consumes a representation of your (J) program
and produces a (hopefully equivalent) program in another language.
Then you run this second program on an interpreter for this second (aka
target) language.
3. A Racket embedding elaborates J programs (possibly parenthesized, possibly
in original ugly syntax) into Racket and then Racket takes over.
What’s the difference to 2? You directly re-use the underlying language
and you can build the language in an incremental manner writing incredibly
small pieces of a compiler at a time.
The efforts are vastly different, and so are the trade-offs.
> On Feb 23, 2018, at 7:31 PM, Raoul Schorer <[email protected]> wrote:
>
> Hi,
>
> I am trying to write an interpreter for J in Racket as a hobby project.
> Would you guys know of good references on writing interpreters?
>
> Some nice things I found:
> craftinginterpreters.com
> <http://www.craftinginterpreters.com/introduction.html>
This teaches you how to write an interpreter (1). I’d also look at Shriram
Krishnamurthi’s PLAI, which is also linked into the Racket web site.
> beautifulracket.com <https://beautifulracket.com/>This is about Racket
> embeddings (3). Great approach, everyone’s darling around here.
> Racket J experimental package <https://github.com/lwhjp/racket-jlang>The docs
> suggest that this is a truly strange approach, writing programs as strings
> and then compiling them into Racket. If I misunderstood, the author of the
> package should please speak up.
I think approach 3 is your best bet to learn Racket and the capability of
producing a language.
>
> Would you know of more?
>
> Cheers,
> Raoul
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected]
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.