caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Request for hint/help in camlp4/5-ppx conversion of famous logic quotation code by Harrison
@ 2018-11-04 17:41 Rudi Cilibrasi
  2018-11-04 18:00 ` Gabriel Scherer
  0 siblings, 1 reply; 3+ messages in thread
From: Rudi Cilibrasi @ 2018-11-04 17:41 UTC (permalink / raw)
  To: caml-list

[-- 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 --]

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

end of thread, other threads:[~2018-11-04 17:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-04 17:41 [Caml-list] Request for hint/help in camlp4/5-ppx conversion of famous logic quotation code by Harrison Rudi Cilibrasi
2018-11-04 18:00 ` Gabriel Scherer
2018-11-04 18:06   ` Gabriel Scherer

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).