Skip to content

Commit

Permalink
[skipci] RST doc WIP
Browse files Browse the repository at this point in the history
Signed-off-by: Kakadu <Kakadu@pm.me>
  • Loading branch information
Kakadu committed Sep 24, 2023
1 parent a386619 commit f70a969
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 16 deletions.
8 changes: 8 additions & 0 deletions doc/Appendo.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. _appendo:

Hello world using Appendo Relation
==================================

.. todo::

Put https://kakadu.github.io/2021/appendo.html here
2 changes: 1 addition & 1 deletion doc/Installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ OCanren can be installed using `opam <https://opam.ocaml.org/doc/Install.html>`_
install opam itself, initialize it and install right compiler version.

* ``opam init --bare`` if your opam has not been initialized before
* ``opam switch create 4.14.1 --packages=ocaml-variants.4.14.0+options,ocaml-option-flambda`` installes right compiler. (4.14.1 is a custom switch identifier)
* ``opam switch create 4.14.1 --packages=ocaml-variants.4.14.1+options,ocaml-option-flambda`` installes right compiler. (4.14.1 is a custom switch identifier)
* ``eval $(opam env)`` updates an environment. Opam will put the invocation of this command to your ``~/.bashrc``.
* check that ``ocamlc -v`` prints right compiler version

Expand Down
31 changes: 21 additions & 10 deletions doc/camlp5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,29 @@ expression to its string form. For example, it rewrites ``let _ = REPR(1+2)`` to

.. code-block::
$ camlp5o `ocamlfind query logger`/pa_log.cmo pr_o.cmo a.ml
let _ = "1 + 2", 1 + 2
$ echo 'REPR(1+2)' > /tmp/a.ml
$ camlp5o `ocamlfind query logger`/pa_log.cmo pr_o.cmo /tmp/a.ml
let _ = "1 + 2", 1 + 2
For OCanren itself we use syntax extension to simplify writing relational programs

.. code-block::
$ cat a.ml
let _ = fresh (x) z
$ camlp5o _build/camlp5/pa_ocanren.cmo pr_o.cmo a.ml
let _ = OCanren.Fresh.one (fun x -> delay (fun () -> z))
$ echo 'let _ = fresh (x) z' > /tmp/a.ml
$ camlp5o _build/default/camlp5/pa_ocanren.cma pr_o.cmo /tmp/a.ml
let _ = OCanren.Fresh.one (fun x -> delay (fun () -> z))
Camlp5 syntax extension is actually two syntax extensions

* the one that make syntax similar to Scheme's miniKanren. PPXes do the same.
* another one, which makes it more ocaml-like (@dboulytchev likes this syntax very much)

Here we will try to describe the second one.

.. note::

Frankly speaking, PPXes are documented better.

.. _ocanren-vs-miniKanren:

Expand Down Expand Up @@ -59,13 +71,12 @@ OCanren-specific Camlp5 syntax extension

This section is a part of Yue Li's tutorial on OCanren.

We take a
look at the
We take a look at the
`implementation <https://github.com/JetBrains-Research/OCanren/blob/master/camlp5/pa_ocanren.ml>`__ of
the ``ocanren{}`` quotation which we will call *the formula parser* in
the rest of this lesson. Our terminology follows `Camlp5 Reference
Manual <https://camlp5.github.io/doc/htmlc/>`__. We take a top-down
approach, starting with an overview of the structure of the parser, then
Manual <https://camlp5.github.io/doc/htmlc/>`__.
We take a top-down approach, starting with an overview of the structure of the parser, then
explain its individual parts.

The structure of the parser: an overview
Expand Down
4 changes: 2 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@

# General information about the project.
project = 'OCanren'
copyright = u'2022, JetBrains Research'
author = u'JetBrains Research'
copyright = u'2023-... PLTools Team; 2015-2022, JetBrains Research.'
author = u'PLTools Team'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
3 changes: 2 additions & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ Welcome to OCanren's documentation!
.. toctree::
:maxdepth: 1

tuto_main/tuto_main
Installation
PPX
Appendo
tuto_main/tuto_main
camlp5
papers

Expand Down
4 changes: 2 additions & 2 deletions doc/tuto_main/tuto_main.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
The Tutorial
============
Yue Li's tutorial
=================

.. toctree::
:maxdepth: 1
Expand Down

0 comments on commit f70a969

Please sign in to comment.