caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: redfire <jeremie.salvucci@free.fr>
To: caml-list@inria.fr
Subject: [Caml-list] Byte code generation for the Ocaml virtual machine (ZAM)
Date: Sun, 01 May 2011 12:10:54 +0200	[thread overview]
Message-ID: <1304244654.4147.34.camel@localhost.localdomain> (raw)

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


             reply	other threads:[~2011-05-01 10:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-01 10:10 redfire [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1304244654.4147.34.camel@localhost.localdomain \
    --to=jeremie.salvucci@free.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).