[Openmcl-devel] consing

Taoufik Dachraoui dachraoui.taoufik at gmail.com
Tue May 14 11:26:13 PDT 2013


Thank you Pascal exactly what I needed; the example you referenced is most
helpful, thank you.

I was thinking of implementing stacks using arrays; the code in the example
will certainly be
very helpful.


Taoufik


On Tue, May 14, 2013 at 7:47 PM, Pascal J. Bourguignon <
pjb at informatimago.com> wrote:

> Taoufik Dachraoui <dachraoui.taoufik at gmail.com> writes:
>
> > Or, how do you implement a VM using CCL for a new language? (any
> > thing offered by CCL even if it is not
> > standard would be acceptable).
>
> You would implement a VM stack as a vector with a fill-pointer, possibly
> adjustable if you want to allow the stack to grow over the initial size.
>
>
> (defun make-vm-stack (size)
>   (make-array size :fill-pointer 0 :adjustable t))
>
> (defun vm-push (element stack)
>    (vector-push-extend element stack))
>
> (defun vm-pop (stack)
>    (vector-pop stack))
>
>
> For an example, see:
>
>
> http://fossil.nasium-lse.ogamita.com/nasium-lse/artifact/aaaed70c3800fb2794c752be7ab5412204151390
>
>
> --
> __Pascal Bourguignon__                     http://www.informatimago.com/
> A bad day in () is better than a good day in {}.
> You can take the lisper out of the lisp job, but you can't take the lisp
> out
> of the lisper (; -- antifuchs
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20130514/2430bde1/attachment.htm>


More information about the Openmcl-devel mailing list