Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added documentation for hop and pure functions #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified diagrams/effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added diagrams/hop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 27 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ <h2><code><dfn>effect</dfn></code></h2>
</p>
<blockquote>
<pre>
<a>effect</a> ::= <a>act</a> | <a>set</a> | <a>def</a> | <a>run</a> | <a>use</a> | <a>pop</a>
<a>effect</a> ::= <a>act</a> | <a>set</a> | <a>def</a> | <a>run</a> | <a>use</a> | <a>pop</a> | <a>hop</a>
</pre>
</blockquote>
<figure id="effect-railroad">
Expand All @@ -682,6 +682,27 @@ <h2><code><dfn>effect</dfn></code></h2>
</figure>
</section>

<section>
<h2><code><dfn>hop</dfn></code></h2>
<p>
A <a>hop</a> statement specifies an ancestry return point from the current node. Recall that DMPL follows a
natural tree-like structure, the ancestors mentioned here refer to the parent, grandparent, etc. of the
current node.
</p>
<blockquote>
<pre>
<a>hop</a> ::= '"hop"' ':' <a>digit</a>
</pre>
</blockquote>
<figure id="hop-railroad">
<img src="diagrams/hop.png" alt="Hop railroad diagram">
<figcaption>Hop</figcaption>
</figure>
<pre class="example" title="hop">
"@hop": 3
</pre>
</section>

<section>
<h2><code><dfn>act</dfn></code></h2>
<p>
Expand Down Expand Up @@ -754,6 +775,11 @@ <h2><code><dfn>def</dfn></code></h2>
When an operator is called, <a>def</a> and <a>set</a> statements inside the body of the operator
will only create local symbols that shadow symbols in the enclosing scope.
</p>
<p>
Note that in order to enforce <dfn>pure custom operator's</dfn> in DMPL, statements with
side effects such as <a>act</a> and <a>run</a> are not recommended within the body of a user defined
custom operator.
</p>
<blockquote>
<pre>
<a>def</a> ::= '"@def"' ':' <a>expression</a> ',' '"val"' ':' <a>statement</a>
Expand Down