Skip to content

Commit

Permalink
[doc] Update pretty printing
Browse files Browse the repository at this point in the history
[refactor] Move jsontemplate.py to vendor/
  • Loading branch information
Andy C committed Mar 6, 2024
1 parent 82f15ff commit 80a105d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
24 changes: 16 additions & 8 deletions doc/pretty-printing.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,11 @@ Risks:

I added some stubs in the code:

- [data_lang/pretty.asdl]($oil-src) - how we would express the IR
- [data_lang/pretty.py]($oil-src) - YSH conversion.
- [data_lang/pretty.asdl]($oils-src) - How we would express the IR
- [data_lang/pretty.py]($oils-src) - YSH conversion.
- [data_lang/pretty-benchmark.sh]($oils-src) - Our naive ASDL pretty printer is
slow. It can take more than 3 seconds on a big file, vs. ~100ms to parse it.
(It does print over 100 MB of text though.)

To generate Python code from the ASDL schema, run `build/py.sh all`.
Otherwise, Oils is a plain Python 2 program, with a few C extensions.
Expand All @@ -336,6 +339,11 @@ For new contributors:
- [Contributing]($wiki) on the wiki
- [Where Contributors Have Problems]($wiki)

There is also a stub for the formatter:

- [tools/fmt.py]($oils-src) - Stub file for the formatter.
- Code copied from [tools/ysh_ify.py]($oils-src).

## Design Questions

This section has some less concrete thoughts.
Expand Down Expand Up @@ -378,19 +386,19 @@ worth it here.

### NIL8 - Uses cases for both Code and Data

What is "NIL8"? We don't know if's a good idea yet, but it may be part of [J8
Notation](j8-notation.html).
What is "NIL8"? We don't know if it's a good idea yet, but it may be part of
[J8 Notation](j8-notation.html).

Think:

- A mash-up of [JSON][] and S-expressions
- *NIL8 Isn't Lisp*
- *Narrow Intermediate Language*
- WebAssembly text format.
- It can also be an IR for an **imperative** language, with a Lisp-y syntax.
- WebAssembly text format
- An IR for an **imperative** language, with a Lisp-y syntax.
- An **exterior** S-expression format
- Blog: [Oils is Exterior-First](https://www.oilshell.org/blog/2023/06/ysh-design.html))
- I posted POSE on lobste.rs for this reason:
- Blog: [Oils is Exterior-First](https://www.oilshell.org/blog/2023/06/ysh-design.html)
- I posted POSE (portable s-expressions) on lobste.rs for this reason:
<https://lobste.rs/s/lwf4jv/pose_portable_s_expressions_pose_spec> (no
comments)

Expand Down
3 changes: 1 addition & 2 deletions doctools/src_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@

from doctools.util import log
from doctools import html_head

from test import jsontemplate
from test import wild_report
from vendor import jsontemplate

T = jsontemplate.Template

Expand Down
2 changes: 1 addition & 1 deletion soil/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import re
import sys
from doctools import html_head
from test import jsontemplate
from vendor import jsontemplate


def log(msg, *args):
Expand Down
2 changes: 1 addition & 1 deletion test/wild_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import os
import sys

import jsontemplate
from vendor import jsontemplate

# JSON Template Evaluation:
#
Expand Down
File renamed without changes.

0 comments on commit 80a105d

Please sign in to comment.