Re: [racket-users] What are good references for implementing interpreters in Racket (or Scheme/LISP)?

2018-02-28 Thread Justin Slepak
> 
> On Feb 23, 2018, at 8:56 PM, Matthias Felleisen  
> wrote:
> 
>>  • Racket J experimental package
> The docs suggest that this is a truly strange approach, writing programs as 
> strings and then compiling them into Racket.
> 

This is a common thing with J implementations. J has the rough idea of syntax 
trees, but not exactly as a static property of a piece of code. Juxtaposition 
is very overloaded in J's concrete syntax. The way code parses (whether it's 
first-order function application, second-order function application, or a 
function composition form; which terms are arguments to which others, etc.) 
depends on the values held dynamically by the identifiers appearing in that 
code. The usual resources on how to write an interpreter by mapping abstract 
syntax to behavior don't quite get the job done for J because it's nonobvious 
how to map a whole program's concrete syntax to abstract syntax. Whether a 
given program has definite a parse tree is undecidable, so J implementations 
either don't statically construct a parse tree for the whole program or don't 
implement all of J. In the case of this package, the parser only gets as far as 
the paren-nesting structure, and then resolving anything within parens is 
handled at run time by the `sentence' procedure in private/sentence.rkt.

---
Justin Slepak
PhD student, CCIS

-- 
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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] What are good references for implementing interpreters in Racket (or Scheme/LISP)?

2018-02-23 Thread Matthias Felleisen

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  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 
> 
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 This is about Racket 
> embeddings (3). Great approach, everyone’s darling around here. 

> Racket J experimental package 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 racket-users+unsubscr...@googlegroups.com 
> .
> For more options, visit 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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] What are good references for implementing interpreters in Racket (or Scheme/LISP)?

2018-02-23 Thread Raoul Schorer
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 
   
   - beautifulracket.com
   - Racket J experimental package 


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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.