Skip to content

Commit 2befa89

Browse files
Update docs.
1 parent 02cae87 commit 2befa89

File tree

4 files changed

+75
-7
lines changed

4 files changed

+75
-7
lines changed

docs/how-to-guides.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ file_format: mystnb
66

77
## Parsing and running program strings
88

9-
You can provide your program in a special DSL language. You can parse this with {meth}`egglog.bindings.parse_program` and then run the result with You can parse this with {meth}`egglog.bindings.EGraph.run_program`::
9+
You can provide your program in a special DSL language. You can parse this with {meth}`egglog.bindings.EGraph.parse_program` and then run the result with You can parse this with {meth}`egglog.bindings.EGraph.run_program`::
1010

1111
```{code-cell}
12-
from egglog.bindings import EGraph, parse_program
12+
from egglog.bindings import EGraph
1313
1414
egraph = EGraph()
15-
commands = parse_program("(check (= (+ 1 2) 3))")
15+
commands = egraph.parse_program("(check (= (+ 1 2) 3))")
1616
commands
1717
```
1818

docs/reference/bindings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ eqsat_basic = """(datatype Math
3636
(check (= expr1 expr2))"""
3737
3838
egraph = EGraph()
39-
commands = parse_program(eqsat_basic)
39+
commands = egraph.parse_program(eqsat_basic)
4040
egraph.run_program(*commands)
4141
```
4242

docs/reference/egglog-translation.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ Any EGraph can also be converted to egglog with the `egraph.as_egglog_string` pr
1212

1313
The currently unsupported features are:
1414

15-
- Proof mode: Not currently tested, but could add support if needed.
16-
- Naive mode: Not currently exposed, but could add support
1715
- `(output ...)`: No examples in the tests, so not sure how this works.
18-
- `(calc ...)`: Could be implemented, but haven't yet.
1916

2017
## Builtin Types
2118

@@ -124,6 +121,16 @@ def my_foo() -> i64:
124121

125122
The static types on the decorator preserve the type of the underlying function, so that they can all be checked statically.
126123

124+
### Functions vs Constructors
125+
126+
Egglog has changed how it handles functions, seperating them into two seperate commands:
127+
128+
- `function` which can include a `merge` expression.
129+
- `constructor` which can include a cost and requires the result to be an "eqsort" aka a non builtin type.
130+
131+
Since this was added after the Python API was first created, we added support to automatically choose between the two based on the return type of the function and whether a merge function is provided. If the return type is a builtin type, it will be a `function`, otherwise it will be a `constructor`, unless it has a merge function
132+
provided then it will always be a `function`.
133+
127134
### Datatype functions
128135

129136
In egglog, the `(datatype ...)` command can also be used to declare functions. All of the functions declared in this block return the type of the declared datatype. Similarly, in Python, any methods of an `Expr` will be registered automatically. These

docs/sg_execution_times.rst

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
2+
:orphan:
3+
4+
.. _sphx_glr_sg_execution_times:
5+
6+
7+
Computation times
8+
=================
9+
**00:10.008** total execution time for 9 files **from all galleries**:
10+
11+
.. container::
12+
13+
.. raw:: html
14+
15+
<style scoped>
16+
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.3.0/css/bootstrap.min.css" rel="stylesheet" />
17+
<link href="https://cdn.datatables.net/1.13.6/css/dataTables.bootstrap5.min.css" rel="stylesheet" />
18+
</style>
19+
<script src="https://code.jquery.com/jquery-3.7.0.js"></script>
20+
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
21+
<script src="https://cdn.datatables.net/1.13.6/js/dataTables.bootstrap5.min.js"></script>
22+
<script type="text/javascript" class="init">
23+
$(document).ready( function () {
24+
$('table.sg-datatable').DataTable({order: [[1, 'desc']]});
25+
} );
26+
</script>
27+
28+
.. list-table::
29+
:header-rows: 1
30+
:class: table table-striped sg-datatable
31+
32+
* - Example
33+
- Time
34+
- Mem (MB)
35+
* - :ref:`sphx_glr_auto_examples_lambda_.py` (``../python/egglog/examples/lambda_.py``)
36+
- 00:07.866
37+
- 0.0
38+
* - :ref:`sphx_glr_auto_examples_ndarrays.py` (``../python/egglog/examples/ndarrays.py``)
39+
- 00:00.605
40+
- 0.0
41+
* - :ref:`sphx_glr_auto_examples_matrix.py` (``../python/egglog/examples/matrix.py``)
42+
- 00:00.405
43+
- 0.0
44+
* - :ref:`sphx_glr_auto_examples_fib.py` (``../python/egglog/examples/fib.py``)
45+
- 00:00.348
46+
- 0.0
47+
* - :ref:`sphx_glr_auto_examples_resolution.py` (``../python/egglog/examples/resolution.py``)
48+
- 00:00.228
49+
- 0.0
50+
* - :ref:`sphx_glr_auto_examples_bool.py` (``../python/egglog/examples/bool.py``)
51+
- 00:00.169
52+
- 0.0
53+
* - :ref:`sphx_glr_auto_examples_higher_order_functions.py` (``../python/egglog/examples/higher_order_functions.py``)
54+
- 00:00.162
55+
- 0.0
56+
* - :ref:`sphx_glr_auto_examples_eqsat_basic.py` (``../python/egglog/examples/eqsat_basic.py``)
57+
- 00:00.130
58+
- 0.0
59+
* - :ref:`sphx_glr_auto_examples_schedule_demo.py` (``../python/egglog/examples/schedule_demo.py``)
60+
- 00:00.096
61+
- 0.0

0 commit comments

Comments
 (0)