caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Joel Reymont <joelr1@gmail.com>
To: "Nicolas Pouillard" <nicolas.pouillard@gmail.com>
Cc: "Caml List" <caml-list@inria.fr>
Subject: Re: [Caml-list] New camlp4 and q_MLast
Date: Sun, 1 Apr 2007 18:08:03 +0100	[thread overview]
Message-ID: <F3C67554-2FE3-4D88-A82F-599BCE2AC6E5@gmail.com> (raw)
In-Reply-To: <cd67f63a0704010956x1e8f8d60m27f0fca7af960a95@mail.gmail.com>


On Apr 1, 2007, at 5:56 PM, Nicolas Pouillard wrote:

> Not gone just renamed (by some very descriptive long name).
>
> Generally one now should use camlp4*f commands (f for full)

I'm trying to translate this command line:

$(OCAMLC) -c -I +camlp4 -pp '$(CAMLP4O) q_MLast.cmo -loc loc' $<

I guess I'll have to go through all the recent camlp4 threads since I  
need to translate the following bits:

(* Build basic ASTs *)

let str_ast a = <:expr< $str:a$ >> ;;

let tuple_ast (a,b) = <:expr< ($a$,$b$) >> ;;

let str_tuple_ast (a,b) = <:expr< ($str:a$,$str:b$) >> ;;

let list_ast el =
         List.fold_right (fun x l -> <:expr< [$x$ :: $l$] >>) el  
<:expr< [] >>
;;

(* Translate TAL expression to method-send expression AST *)

let rec translate_expression ?(base=None) s =
         let extend_base x = match base with
                 | Some (e,var) -> (<:expr< $e$#$x$ >>,var)
                 | None -> (<:expr< $lid:x$ >>, x)

let xml_element_ast e attr children =
         <:expr< Xml.Element ($str:e$, $attr$, $children$) >>
;;

let exp = list_ast exps in
                         <:expr< List.flatten $exp$ >>

let tagast = xml_element_ast e vattrs <:expr< subtags_octalvar__
 >> in
                 let taglistast = list_ast [ tagast ] in
                 (<:expr<
                         let subtags_octalvar__ = $childrenast$ in
                         if $exp$ then subtags_octalvar__ else  
$taglistast$
                 >>,nvars,true)

                 let repexp = <:expr< List.map (fun $lid:itemname$ ->  
$sub$) $exp
$ >> in
                 if sublist then
                         (<:expr< List.flatten $repexp$ >>,fvars,true)

etc.

This all part of the Octal package. Any help will be appreciated! :D

	Thanks, Joel


--
http://wagerlabs.com/






  reply	other threads:[~2007-04-01 17:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-31 10:39 Joel Reymont
2007-04-01 16:56 ` [Caml-list] " Nicolas Pouillard
2007-04-01 17:08   ` Joel Reymont [this message]
2007-04-01 17:28     ` Nicolas Pouillard

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=F3C67554-2FE3-4D88-A82F-599BCE2AC6E5@gmail.com \
    --to=joelr1@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=nicolas.pouillard@gmail.com \
    /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).