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

Add examples to rewrite docs #608

Merged
merged 4 commits into from
Dec 4, 2024
Merged
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
2 changes: 1 addition & 1 deletion scripts/update-markdown.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ mdsh -i site/docs/src/contributing.md --work_dir .

cp site/docs/src/contributing.md CONTRIBUTING.md

rm celsius.phi
rm celsius.phi bar.phi

npm i
npx prettier -w "**/*.md"
65 changes: 65 additions & 0 deletions site/docs/src/eo-phi-normalizer/rewrite.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,51 @@ Result 1 out of 1:
----------------------------------------------------
```

### `--chain` `--tex`

```$ as tex
printf "{⟦ m ↦ ⟦ x ↦ ⟦ t ↦ ⟦ Δ ⤍ 42- ⟧ ⟧.t ⟧.x ⟧}" > bar.phi

eo-phi-normalizer rewrite --chain --tex bar.phi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no bar.phi in the repo. I'll add generation of this file.

```

```tex
% Rule set following Nov 2024 revision

\documentclass{article}
\usepackage{eolang}
\begin{document}


This is the 1st possible chain of normalizing rewritings:

\begin{phiquation*}
[[ m -> [[ x -> [[ t -> [[ D> 42- ]] ]].t ]].x ]] \trans_{\rulename{DOT}}
\trans [[ m -> [[ x -> [[ D> 42- ]]( ^ -> [[ t -> [[ D> 42- ]] ]] ) ]].x ]] \trans_{\rulename{DOT}}
\trans [[ m -> [[ D> 42- ]]( ^ -> [[ t -> [[ D> 42- ]] ]] )( ^ -> [[ x -> [[ D> 42- ]]( ^ -> [[ t -> [[ D> 42- ]] ]] ) ]] ) ]] \trans_{\rulename{RHO}}
\trans [[ m -> [[ D> 42-, ^ -> [[ t -> [[ D> 42- ]] ]] ]]( )( ^ -> [[ x -> [[ D> 42- ]]( ^ -> [[ t -> [[ D> 42- ]] ]] ) ]] ) ]] \trans_{\rulename{DUP}}
\trans [[ m -> [[ D> 42-, ^ -> [[ t -> [[ D> 42- ]] ]] ]]( ^ -> [[ x -> [[ D> 42- ]]( ^ -> [[ t -> [[ D> 42- ]] ]] ) ]] ) ]] \trans_{\rulename{STAY}}
\trans [[ m -> [[ ^ -> [[ t -> [[ D> 42- ]] ]], D> 42- ]]( ) ]] \trans_{\rulename{DUP}}
\trans [[ m -> [[ ^ -> [[ t -> [[ D> 42- ]] ]], D> 42- ]] ]] \trans_{\rulename{Normal form}}
\trans [[ m -> [[ ^ -> [[ t -> [[ D> 42- ]] ]], D> 42- ]] ]].
\end{phiquation*}

This is the 2nd possible chain of normalizing rewritings:

\begin{phiquation*}
[[ m -> [[ x -> [[ t -> [[ D> 42- ]] ]].t ]].x ]] \trans_{\rulename{DOT}}
\trans [[ m -> [[ x -> [[ D> 42- ]]( ^ -> [[ t -> [[ D> 42- ]] ]] ) ]].x ]] \trans_{\rulename{RHO}}
\trans [[ m -> [[ x -> [[ D> 42-, ^ -> [[ t -> [[ D> 42- ]] ]] ]]( ) ]].x ]] \trans_{\rulename{DUP}}
\trans [[ m -> [[ x -> [[ D> 42-, ^ -> [[ t -> [[ D> 42- ]] ]] ]] ]].x ]] \trans_{\rulename{DOT}}
\trans [[ m -> [[ D> 42-, ^ -> [[ t -> [[ D> 42- ]] ]] ]]( ^ -> [[ x -> [[ D> 42-, ^ -> [[ t -> [[ D> 42- ]] ]] ]] ]] ) ]] \trans_{\rulename{STAY}}
\trans [[ m -> [[ ^ -> [[ t -> [[ D> 42- ]] ]], D> 42- ]]( ) ]] \trans_{\rulename{DUP}}
\trans [[ m -> [[ ^ -> [[ t -> [[ D> 42- ]] ]], D> 42- ]] ]] \trans_{\rulename{Normal form}}
\trans [[ m -> [[ ^ -> [[ t -> [[ D> 42- ]] ]], D> 42- ]] ]].
\end{phiquation*}

\end{document}
```

### `--json`

```$ as json
Expand Down Expand Up @@ -235,6 +280,26 @@ eo-phi-normalizer rewrite --single --json --rules ./eo-phi-normalizer/test/eo/ph
"{\n ⟦\n c ↦ Φ.org.eolang.float (\n as-bytes ↦ Φ.org.eolang.bytes (\n Δ ⤍ 40-39-00-00-00-00-00-00\n )\n ),\n result ↦ ξ.c.times (\n x ↦ ⟦\n Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD\n ⟧\n )\n .plus (\n x ↦ ⟦\n Δ ⤍ 40-40-00-00-00-00-00-00\n ⟧\n ),\n λ ⤍ Package\n ⟧\n}"
```

### `--tex`

```$ as tex
eo-phi-normalizer rewrite --tex bar.phi
```

```tex
% Rule set following Nov 2024 revision

\documentclass{article}
\usepackage{eolang}
\begin{document}

\begin{phiquation*}
[[ m -> [[ ^ -> [[ t -> [[ D> 42- ]] ]], D> 42- ]] ]]
\end{phiquation*}

\end{document}
```

### `--output-file FILE`

Redirects the output to file of the given path instead of `stdout`.
Expand Down
Loading