You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 872d13c
Browse filesBrowse the repository at this point in the historyBrowse files
fix(faces): fix four PseudoScript transformer bugs (#118)
* fix(faces): fix four pseudocode-face transformer bugs
- `output X` / `print X` / `display X` now lowers to `println(X)`
instead of `IO.println(X)` (dropped stray `IO.` prefix).
- `--` comment lines converted by `transform_double_dash_comment` no
longer fall through to `apply_boolean_ops`, so `or` inside a comment
is not clobbered with `||`.
- `if`/`else if`/`while`/`for`/`match` condition strings now go through
`apply_comparisons`, `apply_boolean_ops`, and `apply_literal_subs`
before being emitted, so pseudocode operators in conditions lower
correctly.
- `transform_source` replaced with a brace-depth-tracking pass that
inserts `;` after non-tail statements inside blocks, enabling
multi-statement function bodies.
Updated `examples/faces/hello-pseudo.affine` to exercise `set X to Y`
and `output X` in a two-statement body. Updated snapshot.
Removed the now-fixed Pseudocode row from `examples/faces/README.adoc`.
* fix(faces/pseudo): preserve indentation in transform_set
`transform_set` was calling `String.trim line` immediately, discarding
any leading whitespace. Statements like ` set x to expr` inside a
function body would lower to `let x = expr` at column 0, producing a
snapshot mismatch with the 4-space-indented expected output.
Fix: capture the leading indent before trimming and prepend it to the
generated `let`/`let mut` expression.
https://claude.ai/code/session_01Vrh2f1G8tf7ZbNcKh9r5U9
---------
Co-authored-by: Claude <noreply@anthropic.com>
* These examples demonstrate *surface syntax*. They are written to round-trip through their respective transformers (preview → canonical → parse) so the regression test in `tests/faces/` can catch drift, not to be full type-correct, runnable programs. That depends on what's in scope from `stdlib/`.
80
+
* These examples demonstrate *surface syntax*. They are written to round-trip through their respective transformers (preview → canonical → parse) so the regression test in `tests/faces/` can catch drift, not to be full type-correct, runnable programs. That depends on what’s in scope from `stdlib/`.
81
81
* Span fidelity: error messages from non-canonical faces refer to the canonical-text form (post-transform), not the original face source. This is a known limitation of all face transformers, including the original three.
82
-
* The examples deliberately avoid features each transformer can't yet handle. Known transformer gaps that the simpler examples sidestep:
82
+
* The examples deliberately avoid features each transformer can’t yet handle. Known transformer gaps that the simpler examples sidestep:
83
83
+
84
84
[cols="1,3"]
85
85
|===
86
86
| Face | Pending transformer work
87
87
88
88
| Python (Rattle)
89
-
| Bare assignment `x = y` is not yet auto-lifted to `let x = y` (the example uses explicit `let`); `import a.b` lowering does not produce the canonical `use a::b::{…};` brace form.
90
-
91
-
| JS (Jaffa)
92
-
| `import { x } from "module";` lowering has a string-stripping bug when the trailing `;` is present (the example avoids `import` entirely for now).
93
-
94
-
| Pseudocode (Pseudo)
95
-
| No automatic `;` between non-tail statements — examples use single-statement function bodies. Token substitutions can bleed into comment text (e.g. `or` → `\|\|` inside a `//` comment). `output X` lowers to `IO.println(X)` rather than canonical `println(X)`.
89
+
| Bare assignment `x = y` is not yet auto-lifted to `let x = y` (the example uses explicit `let`); `import a.b` lowering does not produce the canonical `use a::b::{...};` brace form.
96
90
97
91
| Lucid (PureScript)
98
92
| Haskell-style currying calls `f x` are NOT converted to canonical `f(x)` — the example uses canonical paren syntax. Multi-clause definitions, `do`-notation, and `where`-block hoisting are deferred to AST-level rewrites.
0 commit comments