caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Byte code generation for the Ocaml virtual machine (ZAM)
@ 2011-05-01 10:10 redfire
  2011-05-01 10:30 ` Basile Starynkevitch
  0 siblings, 1 reply; 5+ messages in thread
From: redfire @ 2011-05-01 10:10 UTC (permalink / raw)
  To: caml-list

Hello all,

I'm currently doing a student project where I have to generate bytecode
for the caml virtual machine. I convert a subset of the Scheme language.
My main issue concerns the dynamic typing mechanism. My idea is to store
every values I manipulate like this (type, value).
But I have a problem with the generation of the data section. For the
moment, I found on the Internet a snippet using the Obj module but I
don't exactly know what this implies in the rest of the code (especially
Obj.repr). The Obj.repr allows the possibility to mix datas of different
type in the same table. Then I can do an output_value (Pervasives) on it
and my data section seems to be correct.

I have a problem to get back these information. With the snippet using
Obj, I was hoping to get a block structure with field 0 -> type and
field 1 -> value. But it doesn't seem to be the case.

With a piece of code maybe it's going to be clearer.

Example of data : (2, 5). 2 is for the type, so here we suppose that 2
means integer and 5 the value integer.
For the moment, I store Obj.repr (2, 5) in a table (code from the
snippet of the Internet), but it doesn't work.
At generation time, I do a output_value oc t where t is the table
containing all tuples.

So what I'm looking for, is a way to get back a block of size 2 with a
field 0 for the type and then field 1 for the value. Is it possible ?

Thank you for your time ;-)

Cheers.

--
Jeremie Salvucci


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-05-01 14:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-01 10:10 [Caml-list] Byte code generation for the Ocaml virtual machine (ZAM) redfire
2011-05-01 10:30 ` Basile Starynkevitch
2011-05-01 10:55   ` redfire
     [not found]     ` <20110501130102.GX17796@localhost>
2011-05-01 13:24       ` redfire
2011-05-01 14:15     ` Guillaume Yziquel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).