Use Condy to implement a Lisp evaluator in the constant pool

forax at univ-mlv.fr forax at univ-mlv.fr
Sun Oct 1 17:34:34 UTC 2017



----- Mail original -----
> De: "B. Blaser" <bsrbnd at gmail.com>
> À: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "amber-dev" <amber-dev at openjdk.java.net>
> Envoyé: Dimanche 1 Octobre 2017 17:26:42
> Objet: Re: Use Condy to implement a Lisp evaluator in the constant pool

> Hi Rémi,

Hi Bernard,

> 
> On 1 October 2017 at 12:47, Remi Forax <forax at univ-mlv.fr> wrote:
>> With a bootstrap method that evaluates what is sent as parameter, it's possible
>> to encode s-expressions as a bunch condys.
>>   https://github.com/forax/cplisp
>>
>> enjoy,
>> Rémi
> 
> !!! GREAT !!!
> 
> I didn't had time to play with it yet, but I have a few questions
> since I tried to do something like that some time ago at a higher
> level (using an annotation processor and reflection [1]):
> 
> 1) As s-expressions are encoded in the constant pool, it seems that
> they are static. So, it's possible to compile and evaluate them, but
> it doesn't seem possible to dynamically (at runtime) modify them, is
> that right?

a s-expression encoded in the classfile is static but the bootstrap method transform it to a dynamic representation [1], BTW, i should create an ArrayList instead of using Arrays.asList.

> 
> 2) I didn't see any quotation feature, did I miss it? Note that
> implementing a "quote()" function wouldn't be too difficult, I
> think...

Very good question, i've forgotten to mention that in the README.

To implement quote, arguments should not be evaluated too early, it is not possible to implement quote with condy currently because the VM first evaluates the boostrap arguments then call the boostrap method so the arguments are evaluated before a function like quote is called (you have the same issue if you try to create a lambda or something as simple as an if). 

John already sent a proposal on the EG mailing list to allow arguments of the BSM to not be evaluated too early, it's the reason why i've thought about implementing a Lisp using condy.

Rémi

[1] https://github.com/forax/cplisp/blob/master/src/java/main/fr.umlv.cplisp/fr/umlv/cplisp/CpLisp.java#L492

> 
> Cheers,
> Bernard
> 
> [1] https://github.com/bsrbnd/draft


More information about the amber-dev mailing list