caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Rudi Cilibrasi <cilibrar@gmail.com>
To: caml-list@inria.fr
Subject: [Caml-list] Request for hint/help in camlp4/5-ppx conversion of famous logic quotation code by Harrison
Date: Sun, 4 Nov 2018 09:41:38 -0800	[thread overview]
Message-ID: <CABvMw3bYyJYOxJAYQBANMgVqMa+XYkW3pOQ-2MXA5ZF4czBV-w@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2800 bytes --]

Greetings ML friends,

I have been gradually following the ML style languages a couple decades
with HOL/SML etc and recently got interested in the OCaml variation.

I've been able to make simple OCaml programs for my research but am
hitting a steep learning curve trying to understand the differences
between the preprocessors camlp4, camlp5, and ppx. The documentation
is confusing to me at this point.

I have been trying to compile the code from the famous and great book
on logic called "Handbook of Practical Logic and Automated Reasoning"
but it does not work for me under Ubuntu 18.04 using OCaml 4.05. I
have opam 1.2.2.  I am getting an "Unbound module Quotation" error
that Icannot solve and I suspect is related to old coding convention
for preprocessing.  Would anybody on the list be able to help me (perhaps
privately via email/github) to convert this small fragment to modern
PPX syntax so that we can "unlock" the rest of the code describing first
order logic?  I attach a transcript below trying to compile one of many
copies of the same code on github, this one from

https://github.com/logic-tools/sml-handbook/tree/master/code/OCaml

Any help or info you can provide to get unblocked would be appreciated.
Thank you in advance for your kind attention.

Best regards,

Rudi
----------------------------------------------------------------------------------------
➜  sml-handbook git:(master) ✗ cd code/OCaml
➜  OCaml git:(master) ✗ make
echo '#use "init.ml";;' >.ocamlinit; (sleep 3s; rm -f .ocamlinit) & ocaml
        OCaml version 4.05.0

File "Quotexpander.ml", line 2, characters 5-72:
Warning 3: deprecated: Pervasives.&
Use (&&) instead.
File "Quotexpander.ml", line 7, characters 0-13:
Error: Unbound module Quotation
File "Quotexpander.ml", line 998, characters 7-9:
Unbound quotation: ""
Camlp5 parsing version 7.06

#
➜  OCaml git:(master) ✗ cat Quotexpander.ml
let quotexpander s =
  if String.sub s 0 1 = "|" & String.sub s (String.length s - 1) 1 = "|"
then
    "secondary_parser \""^
    (String.escaped (String.sub s 1 (String.length s - 2)))^"\""
  else "default_parser \""^(String.escaped s)^"\"";;

Quotation.add "" (Quotation.ExStr (fun x -> quotexpander));;
➜  OCaml git:(master) ✗ ocaml --version
The OCaml toplevel, version 4.05.0
➜  OCaml git:(master) ✗ opam --version
1.2.2
➜  OCaml git:(master) ✗


-- 
Happy to Code with Integrity : Software Engineering Code of Ethics and
Professional Practice <http://www.acm.org/about/about/se-code>

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list https://inbox.ocaml.org/caml-list
Forum: https://discuss.ocaml.org/
Bug reports: http://caml.inria.fr/bin/caml-bugs

[-- Attachment #2: Type: text/html, Size: 3731 bytes --]

             reply	other threads:[~2018-11-04 17:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-04 17:41 Rudi Cilibrasi [this message]
2018-11-04 18:00 ` Gabriel Scherer
2018-11-04 18:06   ` Gabriel Scherer

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=CABvMw3bYyJYOxJAYQBANMgVqMa+XYkW3pOQ-2MXA5ZF4czBV-w@mail.gmail.com \
    --to=cilibrar@gmail.com \
    --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).