-
Notifications
You must be signed in to change notification settings - Fork 9
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
Using Latex backend for rendering AL expressions #61
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent, thanks for this! I have few comments that might simplify the translation.
Good point about the cross-refs. I definitely intended the Latex renderer to enable this as well, but your point about needing type information for it is a good one that I hadn't considered. The simplest way to solve this probably is to have the elaborator decorate the EL AST with some extra information on atom nodes, which the renderer then can use. (Rendering from the IL would be difficult, since it loses a lot of information needed for rendering.) I'll think about the best way for doing that.
spectec/src/backend-prose/render.ml
Outdated
(* Expressions and Paths *) | ||
|
||
and render_expr env in_math expr = | ||
(* fallback when expr cannot be embedded in a math block *) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment how this can occur? Can it legally happen, or is it indicative of some internal error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed out on explaining this, sorry for the confusion. In short, it is legal for this to happen, and not an error.
There are certain AL expressions that must be rendered using plaintext, for example TopLabelE
, which should be rendered as “a label is on the top of the stack.” Also, some may contain subexprs, like ContE e
, rendered as “the continuation of … some rendered string of e ….”
Considering this, render_expr
works as follows:
- First try to translate AL expr to EL exp with
al_to_el_exp
. - If the translation succeeds, (indicated by Some), render it using the Latex backend.
- This translation succeeds if and only if the AL expr and all its subexprs are able to be rendered in
:math:
blocks.
- This translation succeeds if and only if the AL expr and all its subexprs are able to be rendered in
- Otherwise (indicated by None), it must be the case that the expr itself or one of its subexpr cannot be rendered in
:math:
. So we fall back to the original prose renderer inrender_expr’
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense, but even if the whole expressions cannot, shouldn't the subexpressions that can still be rendered with the Latex backend? In particular, I would expect that none of the cases for Var, Num, Bool, names, operators (other than Not), accessors, paths, records, iterators, etc., would ever be rendered here directly.
I would assume there must be an invariant somehow that none of the EL-handled cases can contain a subexpression that cannot be rendered as EL.(*) Or is there a counter-example? If so, shouldn't it be necessary to somehow transform it away, e.g., by introducing an auxiliary variable? For example, consider a record with a nested ContE
, wouldn't that produce very jumbled output otherwise?
(*) FWIW, that would also imply that the option monad shouldn't be necessary, since it can only legally fail at the outermost level already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't the subexpressions that can still be rendered with the Latex backend?
Yes, render_expr'
calls render_expr
for rendering its subexpressions. For instance,
and render_expr' env expr =
match expr.it with
...
| Al.Ast.UnE (op, e) ->
let sop = render_al_unop op in
let se = render_expr env e in
sprintf "%s %s" sop se
I would assume there must be an invariant somehow that none of the EL-handled cases can contain a subexpression that cannot be rendered as EL.
There exists a counterexample for AL IterE
. For instance, IsDefinedE
can be its subexpression, IterE (DefinedE (CallE (default, [ CallE (unpacktype, [ VarE (zt) ]) ])), [zt], *)
which should be rendered as for all zt*, $default($unpacktype(zt)) is defined
.
FYI, this prose expression is from the execution semantics of STRUCT.NEW_DEFAULT
, in a step saying: 5. Assert: Due to validation, for all zt*, $default($unpacktype(zt)) is defined.
This is generated from the IL sideconditions.
Other than IterE
, the prose being generated now can be distinguished of EL-handled or not at the top level AST. Nevertheless, I am unsure that such invariant (modulo IterE
) can persist to hold as the spec evolves, so I left render_expr'
as close to the original logic as a foolproof.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, but taking the UnE case as an example, that only makes sense for operators that are themselves in text form. In some of the other cases, the current algorithm would produce math operators outside math, some of that may not even be valid Latex (for example, \cdot
is not allowed outside math mode, likewise things like ^?
).
In other places, parts of a formula are rendered in a split fashion. For example,
| Al.Ast.AccE (e, p) ->
let se = render_expr env e in
let sp = render_path env p in
sprintf "%s%s" se sp
This will not type-set correctly, there needs to be a single math wrapper around both, not two separate ones. However, I don't understand how such cases can even legally arise: if one of the two parts cannot be converted to EL, then that supposedly means that it will be rendered as prose, but then concatenating them without space as if they were formulas doesn't seem right.
That's why there needs to be some invariant. There are three classes of expressions:
- EL-like expressions only containing EL expressions ⇒ rendered by Latex backend
- AL-only expressions, possibly containing EL expressions ⇒ rendered by prose backend except for inner EL
- Pseudo EL-like expressions containing AL expressions ⇒ must be rendered by prose backend, as prose
In particular, all expressions in the 3rd category must be rendered as real prose, since they can contain nested prose. It never makes sense to render them as a formula. For example, if the prose renderer were to encounter an expression like ListE [ContE e1, ContE e2]
, then it would currently generate something like "[the continuation of e1, the continuation of e2]", which is not what we want.
There are only two meaningful possibilities for handling such an example:
-
either it's considered illegal, i.e., no AL-specific expressions can ever occur inside a list, but then
render_expr'
should not handle lists at all -
or it can legally occur, but then
render_expr'
needs to render the list as proper prose, e.g., something like "the sequence consisting of ..., ..., and ..."
Under no circumstances should render_expr'
render any node as a formula-like object. That doesn't compose with nested prose.
Effectively, there are two layers of languages, prose and formula. Ideally the AL AST would separate them as different classes of expressions (possibly duplicating some constructs like iter that can occur on both levels). But short of ensuring the layering by construction, it at least needs to be assumed in the renderer logic.
Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, thank you for the detailed description, things got much clearer to my mind with the categorization.
I prefer the or it can legally occur, but then render_expr' needs to render the list as proper prose, e.g., something like "the sequence consisting of ..., ..., and ..." option. So with the latest commit, I have removed all rendering logic in render_expr'
that belongs to none of the three category, i.e., the ones that produce math-like output in plaintext.
By the fallback logic from render_expr
to render_expr'
, when rendering UnE
in render_expr'
, it must be that the operator is not a formula. But to make things more clear when reading the code, I added a guard indicating that it is the case. And similarly for BinE
and IterE
.
(* before *)
| Al.Ast.UnE (op, e) ->
let sop = render_al_unop op in
let se = render_expr env e in
sprintf "%s %s" sop se
(* now *)
| Al.Ast.UnE (op, e) when Option.is_none (al_to_el_unop op) ->
let sop = render_al_unop op in
let se = render_expr env e in
sprintf "%s %s" sop se
Plus, I do believe that the invariant you made is true, but I added this final case to render_expr'
since I do not want the renderer to crash on some unexpected, peculiar expression form.
| _ ->
let s = Al.Print.string_of_expr expr in
sprintf "warning: %s was not properly handled by prose backend" s |> prerr_endline;
s
And a final remark, I prefer to keep the option monadic translation of AL-expr-to-EL-exp. First, due to the aforementioned presence of IterE
. Second, figuring out if an AL expr is of category 1 and actually carrying out the translation requires one to recurse through all the subexpressions. I prefer to do such in a single function al_to_el_exp
, which returns some EL exp if it belongs to category 1, and none otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, this looks good. A few more comments.
spectec/src/backend-prose/render.ml
Outdated
sprintf "%s is not valid" se | ||
| Al.Ast.UnE (op, e) -> | ||
sprintf "%s is not valid" se | ||
| Al.Ast.UnE (op, e) when Option.is_none (al_to_el_unop op) -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Al.Ast.UnE (op, e) when Option.is_none (al_to_el_unop op) -> | |
| Al.Ast.UnE (op, e) when al_to_el_unop op = None -> |
Also, it would be better to change render_al_unop/binop to return options as well, and check the result of that here instead. Some of their cases still produce formulas, and some of those yield malformed Latex in text. You want to guarantee that this cannot happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I instead enforced render_al_unop
and render_al_binop
to print out textual (or, not-formula) formats only. For instance, render_al_binop
renders Al.Ast.MulOp
as "multiplied by" rather than "\cdot".
So we have a guarantee that inside render_expr'
(which being their only callsites), they will never print formula as plaintext.
Ditto for render_path
mentioned above.
Thank you for #62, all keywords in AL are rendered as EL atoms now. There is one exception though, for the infix operator in AL Plus, I believe bringing the type information from IL to AL would be neater if IL also had atoms annotated with types. Below is the current translation of IL
|
Great, thanks! Yeah, the handling of infix operators in the AL indeed looks like a hack. There is too much hard-coding when translating between IL and AL (il2al/translate MixE) and back to EL, and some of that is lossy, too. For example, I'm certain the current code will not show brackets as e.g. in table/memory types correctly. I suspect that the only reason we are not currently running into that is that we are not yet rendering all validation prose. To work in all cases, But let's keep cleaning that up for a later change. I'll think about annotating IL atoms. It'd be a bit annoying to wrap them everywhere, and it caused me a lot of debugging grief for the EL already, because all equality comparisons on atoms silently started misbehaving. (Too bad OCaml's type system doesn't distinguish comparable types. :( ) FWIW, I plan to also annotate symbolic atoms, since we overload some of them as well. |
Great, happy to see the Latex and prose backends starting to work together 👍 |
* [spec] Add reference types to overview (WebAssembly#1394) * [interpreter] Remove use of physical equality on characters (WebAssembly#1396) * Merge SIMD proposal (WebAssembly#1391) SIMD is [phase 5](WebAssembly/simd#507), merge all the changes back into main spec. * Remove merge conflict marker * [spec] Handle v128 in validation algorithm (WebAssembly#1399) * [spec] Fix instruction table (WebAssembly#1402) * Add tests for functions without end marker. NFC (WebAssembly#1405) Inspired by this downstream test in wabt: WebAssembly/wabt#1775 Fixes: WebAssembly#1404 * Describe correct tail call behavior across modules Whether tail calls across module boundaries would guarantee tail call behavior was previously an open question, but @thibaudmichaud confirmed that they would guarantee tail call behavior in V8 in WebAssembly/tail-call#15 (comment). * [interpreter] Fix a typo in README (WebAssembly#1406) * Add a link to the proposals repo (WebAssembly#1409) Fixes WebAssembly#1407. * [spec] Add note regarding parameter names (WebAssembly#1412) * Comments WIP * Merge upstream (Wasm-DSL#55) * Typo * [spec] Clarifying note on text format (WebAssembly#1420) Signed-off-by: Adrian Cole <[email protected]> Co-authored-by: Andreas Rossberg <[email protected]> * Eps * Eps * [test] Fix section size in binary test (WebAssembly#1424) * Update document README to install six * Disallow type recursion (Wasm-DSL#56) * Fix import order * Add --generate-js-only flag to test runner This will return early right after generating JS from the wast test files. It will not attempt to run the tests, or do the round trip conversion from wasm <-> wast. This is convenient for proposals to add tests without having to update the reference interpreter with implementation, and generate those tests to JS to run in other Wasm engines. Fixes WebAssembly#1430. * Remove use of let from func.bind test * Add call3 * [spec] Fix missing mention of vectype (WebAssembly#1436) Fixed WebAssembly#1435. * [spec] Fix single-table limitation in module instantiation (WebAssembly#1434) * [spec] Fix missing immediate on table.set (WebAssembly#1441) * [docs] Update syntax in examples (WebAssembly#1442) * Clarification in proposals README * [interpreter] Tweak start section AST to match spec * [spec] Bump release to 2 (WebAssembly#1443) At yesterday's WG meeting, we decided to make a new release, now switching to the Evergreen model. For administrative and technical reasons having to do with W3C procedure, we decided to bump the release number to 2. From now on, the standard will iterate at version 2 from the W3C's official perspective. We use minor release numbers internally to distinguish different iterations. (@ericprud, I hope I understood correctly that the Bikeshed "level" also needed to be bumped to 2.) * Remove test cases with let * Sync wpt test (WebAssembly#1449) * [spec] Fix typo (WebAssembly#1448) * [proposals] Add missing start to example (WebAssembly#1454) * [spec] "version 2.0" -> "release 2.0" (WebAssembly#1452) * [spec] Fix typo (WebAssembly#1458) * [test] Add assert_trap for unreached valid case (WebAssembly#1460) * [interpreter] Name the type Utf8.unicode * [spec] Fix binary format of data/elem tags to allow LEB (WebAssembly#1461) * [spec] Fix typos in numeric operations (WebAssembly#1467) * [spec] Fix syntax error in element segments validation rule (WebAssembly#1465) * [spec] Fix typo in global instance syntax (WebAssembly#1466) * [spec] Fix typos in module instantiation (WebAssembly#1468) * [interpreter] Turn into a Dune package (WebAssembly#1459) * [spec] Fix typos in instruction validation rules (WebAssembly#1462) * [bib] Update latex .bib file for webassembly 2.0 (WebAssembly#1463) * [spec] Add missing default for vector types (WebAssembly#1464) * [spec] Fix typos in binary and text formats (WebAssembly#1469) * [spec] Fix various typos (WebAssembly#1470) * TypeError for Global constructor with v128 At the moment the spec requires a `LinkError` to be thrown when the `WebAssembly.Global` constructor is called for type `v128`. This was introduced in WebAssembly/simd#360, but according to the PR description, actually a `TypeError` should be thrown. The PR refers to https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md#javascript-api-and-simd-values, and there a `TypeError` is required. * [spec] Fix LEB opcodes in instruction index (WebAssembly#1475) * [spec] Fix v128.loadX_splat in instruction index (WebAssembly#1477) * [interpreter] Dune test suite (WebAssembly#1478) * [interpreter] Fix warning flags for OCaml 4.13 (WebAssembly#1481) * [interpreter] Simplify lexer and avoid table overflow on some architectures (WebAssembly#1482) * [spec] Editorial nit (WebAssembly#1484) * [interpreter] Produce error messages in encoder (WebAssembly#1488) * [spec] Add missing close paren on table abbreviation (WebAssembly#1486) Also remove an unnecessary space in the previous table abbreviation. * [spec] Remove outdated note (WebAssembly#1491) * Eps * [interpreter] Factor data and element segments into abstract types (WebAssembly#1492) * [spec] Update note on module initialization trapping (WebAssembly#1493) * Fix type equality * Fix typo * [spec] Add note about control stack invariant to algorithm (WebAssembly#1498) * [spec] Tweak tokenisation for text format (WebAssembly#1499) * [test] Use still-illegal opcode (func-refs) (WebAssembly#1501) * Fix minor typos and consistency issues in the validation algorithm. (Wasm-DSL#61) * Add definition of defaultable types (Wasm-DSL#62) No rules for locals yet, since those are still being discussed. * Remove func.bind (Wasm-DSL#64) * Implement 1a (Wasm-DSL#63) * Subtyping on vector types & heap bottom check (Wasm-DSL#66) * [interpreter] Bring AST closer to spec * [spec] Fix typo (WebAssembly#1508) * WIP * Remove polymorphic variants * Minor syntactic consistency fix (Wasm-DSL#68) Change pseudo equality operator from `==` to `=`. * Bump version * [spec] Fix table.copy validation typo (WebAssembly#1511) * More fixes * Fix Latex * Adjust intro * Spec local initialization (Wasm-DSL#67) * Add table initialiser (Wasm-DSL#65) * [spec] Remove outdated note (WebAssembly#1491) * [interpreter] Factor data and element segments into abstract types (WebAssembly#1492) * [spec] Update note on module initialization trapping (WebAssembly#1493) * [spec] Add note about control stack invariant to algorithm (WebAssembly#1498) * [spec] Tweak tokenisation for text format (WebAssembly#1499) * [test] Use still-illegal opcode (func-refs) (WebAssembly#1501) * [spec] Fix typo (WebAssembly#1508) * [spec] Fix table.copy validation typo (WebAssembly#1511) * Merge fallout * Latex fixes * [spec] Minor copy edit (WebAssembly#1512) * Spec changelog * [spec] Trivial editorial fix * Update embedding * Oops * Argh * Rename Sem to Dyn * Readd match.mli * [interpreter] Build wast.js with Js_of_ocaml (WebAssembly#1507) * [interpreter] Add flag for controlling call budget * Spec zero byte * Fix table/elem expansion (Wasm-DSL#71) * Fix merge artefact * Restrict init from stack-polymorphism (Wasm-DSL#75) * [spec] Simplify exec rule for if (WebAssembly#1517) * [spec] Formatting tweak (WebAssembly#1519) * [spec] Fix typing rule in appendix (WebAssembly#1516) * [spec] Fix “invertible” typo (WebAssembly#1520) * [spec] Correct use of opdtype and stacktype (WebAssembly#1524) * [spec] Add note to instruction index (WebAssembly#1528) * Add type annotation to call_ref (Wasm-DSL#76) * [spec] Tweak wording to avoid first person * Eps * Eps2 * Eps3 * Remove unneeded assumption type * [spec/test] Fix scoping of non-imported globals (WebAssembly#1525) * Fix test * A couple of tests * Performance improvement * Typo * Another typo * [spec] Fix language config * Fix null subtyping being wrong way around (Wasm-DSL#79) * [spec] Fix naming typo (WebAssembly#1532) * Defunctorise types again * [spec] Add citation for WasmCert (WebAssembly#1533) * [test] Fix async_index.js * [test] Enable the i64 tests in imports.wast. Fixes WebAssembly#1514. * Minor tweak * [js-api][web-api] Editorial: Fix some minor issues. Fixes WebAssembly#1064. * Update README.md (WebAssembly#1540) Improve wording. * [spec] Fix typo in element execution (WebAssembly#1544) * [spec] Remove obsolete note (WebAssembly#1545) * cccccc[klghketetivvtnnhvntikigrnueuhdkkukljgjuest/meta/generate_*.js: sync upstream JS with tests (WebAssembly#1546) * [spec] Editorial tweak * [test] test segment/table mismatch and externref segment (WebAssembly#1547) * [interpreter] Remove duplicate token declarations (WebAssembly#1548) * Update Soundness appendix (Wasm-DSL#72) * [spec] Formatting eps * Remove oboslete note in README (Wasm-DSL#82) * Add `print_i64` to generated spec tests WebAssembly@82a613d added `print_i64` to the standalone test files, but not to the ones generated by the spec interpreter. * [test] Tweak binary-leb128 and simd_lane (WebAssembly#1555) * [spec] Allow explicit keyword definitions (WebAssembly#1553) Rather than describing keyword tokens as always being defined implicitly by terminal symbols in syntactic productions, describe them as being defined implicitly or explicitly. This accounts for the explicit definitions of `offset` and `align` phrases, which are lexically keywords, later in the chapter. Fixes WebAssembly#1552. * [js-api] editorial: adjust link for v128 type * Factor local init tests to local_init.wast; add more (Wasm-DSL#84) * Update JS API for no-frills * [spec] Add missing case for declarative elem segments Fixes WebAssembly#1562. * [spec] Hotfix last accidental commit * [spec] Fix hyperref (WebAssembly#1563) * [spec] Bump sphinx version to fix Python problem * [spec] Fix minor errors and inconsistencies (WebAssembly#1564) * Spacing * Fix a couple more superfluous brackets * [spec] Eps * [interpreter] Refactor parser to handle select & call_indirect correctly (WebAssembly#1567) * [spec] Remove dead piece of grammar * [test] elem.wast: force to use exprs in a element (WebAssembly#1561) * Fix typos in SIMD exec/instructions * Update interpreter README (WebAssembly#1571) It previously stated that the formal spec did not exist, but the spec has existed for years now. * [spec] Remove an obsolete exec step (WebAssembly#1580) * [test] Optional tableidx for table.{get,set,size,grow,fill} (WebAssembly#1582) * [spec] Fix abstract grammar for const immediate (WebAssembly#1577) * [spec] Fix context composition in text format (WebAssembly#1578) * [spec] Fix label shadowing (WebAssembly#1579) * Try bumping OCaml * Try bumping checkout * Adjust for multi-return * Tweak reduction rules * Spec return_call_ref * Fix * Text format * [spec] Fix typos in instruction index (WebAssembly#1584) * [spec] Fix typo (WebAssembly#1587) * [spec] Remove inconsistent newline (WebAssembly#1589) * [interpreter] Remove legacy bigarray linking (WebAssembly#1593) * [spec] Show scrolls for overflow math blocks (WebAssembly#1594) * [interpreter] Run JS tests via node.js (WebAssembly#1595) * [spec] Remove stray `x` indices (WebAssembly#1598) * [spec] Style tweak for cross-refs * [spec] Style eps (WebAssembly#1601) * Separate subsumption from instr sequencing * State principal types * Add statements about glbs, lubs, and disjoint hierarchies * Add missing bot * [spec] Clarify that atoms can be symbolic (WebAssembly#1602) * [test] Import v128 global (WebAssembly#1597) * Update Overview.md * [js-api] Expose everywhere * [js-api] Try to clarify NaN/infinity handling. (WebAssembly#1535) * [web-api] Correct MIME type check. (WebAssembly#1537) Fixes WebAssembly#1138. * [ci] Pin nodejs version to avoid fetching failures (WebAssembly#1603) The issues appears to be related to actions/runner-images#7002. Co-authored-by: Ms2ger <[email protected]> * [spec] Add missing value to table.grow reduction rule (WebAssembly#1607) * [test] Move SIMD linking test to simd dir (WebAssembly#1610) * Editorial: Clarify the name of the instantiate algorithm. * Add notes to discourage using synchronous APIs. * [jsapi] Normative: Always queue a task during asynchronous instantiation JSC will have to do asynchronous compilation work during some instantiations. To be consistent, this PR always queues a task to complete instantiation, except through the synchronous Instance(module) API, to ensure consistency across platforms. This patch also cleans up the specification in various surrounding ways: - Include notes about APIs whose use is discouraged/may be limited Closes WebAssembly#741 See also webpack/webpack#6433 * [test] Exception -> Tag in wasm-module-builder.js The section name has changed to the tag section a few years ago. This adds the corresponding changes added in WebAssembly/exception-handling#252 and WebAssembly/exception-handling#256. * [spec] Fix reduction rule for label (WebAssembly#1612) Fix WebAssembly#1605. * [spec] Clarifying note about canonical NaNs (WebAssembly#1614) * [spec] Tweak crossref * [test] Fix invalid section ID tests (WebAssembly#1615) * [tests] Disable node run for now * [spec] Don't check in generated index, to avoid spurious merge conflicts * [spec] Rename script * [ci] deactivate node run for now * Fix uses of \to; compositionality * Fix typo in text expansion * Follow-up fix * Fix compilation errors after merge. This commit fixes the errors introduced by the merge of function-references/main into this tree. --------- Signed-off-by: Adrian Cole <[email protected]> Co-authored-by: Andreas Rossberg <[email protected]> Co-authored-by: Hans Höglund <[email protected]> Co-authored-by: Ng Zhi An <[email protected]> Co-authored-by: Ng Zhi An <[email protected]> Co-authored-by: Sam Clegg <[email protected]> Co-authored-by: Thomas Lively <[email protected]> Co-authored-by: Gabor Greif <[email protected]> Co-authored-by: Andreas Rossberg <[email protected]> Co-authored-by: Crypt Keeper <[email protected]> Co-authored-by: Andreas Rossberg <[email protected]> Co-authored-by: Ng Zhi An <[email protected]> Co-authored-by: Ben L. Titzer <[email protected]> Co-authored-by: Keith Winstein <[email protected]> Co-authored-by: gahaas <[email protected]> Co-authored-by: r00ster <[email protected]> Co-authored-by: Timothy McCallum <[email protected]> Co-authored-by: Julien Cretin <[email protected]> Co-authored-by: Julien Cretin <[email protected]> Co-authored-by: Ole Krüger <[email protected]> Co-authored-by: Jämes Ménétrey <[email protected]> Co-authored-by: Ivan Panchenko <[email protected]> Co-authored-by: Ethan Jones <[email protected]> Co-authored-by: Ole Krüger <[email protected]> Co-authored-by: aathan <[email protected]> Co-authored-by: Alberto Fiori <[email protected]> Co-authored-by: mnordine <[email protected]> Co-authored-by: cosine <[email protected]> Co-authored-by: ariez-xyz <[email protected]> Co-authored-by: Surma <[email protected]> Co-authored-by: Asumu Takikawa <[email protected]> Co-authored-by: Ian Henderson <[email protected]> Co-authored-by: Tom Stuart <[email protected]> Co-authored-by: James Browning <[email protected]> Co-authored-by: whirlicote <[email protected]> Co-authored-by: Ms2ger <[email protected]> Co-authored-by: Adam Lancaster <[email protected]> Co-authored-by: Ömer Sinan Ağacan <[email protected]> Co-authored-by: B Szilvasy <[email protected]> Co-authored-by: Thomas Lively <[email protected]> Co-authored-by: Michael Ficarra <[email protected]> Co-authored-by: YAMAMOTO Takashi <[email protected]> Co-authored-by: Thomas Lively <[email protected]> Co-authored-by: candymate <[email protected]> Co-authored-by: Bongjun Jang <[email protected]> Co-authored-by: ShinWonho <[email protected]> Co-authored-by: 서동휘 <[email protected]> Co-authored-by: Jim Blandy <[email protected]> Co-authored-by: Heejin Ahn <[email protected]> Co-authored-by: Daniel Ehrenberg <[email protected]>
This was left over from when we had both 64-bit and 32-bit limits
This resolves issue #59.
(1)
\textrm
is no longer used within inline math blocks(2) Inline math blocks are now rendered using the Latex backend
Previously, parts that are enclosed in :math: were all AL expressions. Now, an AL-expression-to-EL-expression translation phase is added in
backend-prose/render.ml
. After translation, the Latex renderer inbackend-latex
gets to render the portions in math blocks.Since the Latex renderer already handles display hints,
backend-prose/hint.ml
which dealt with hints within the prose backend is now removed.(*) Side-effect: cross-references are no longer inserted
And this also comes with a side-effect that for the most part, cross-references are no longer inserted. Before this change, cross-references were inserted in
CaseE
(constructor) andCallE
expressions. Now that they are all rendered via the Latex backend, which does not support cross-referencing at the moment, the generated PDF does not contain embedded links.So, I believe it would be ideal for the Latex backend to support cross-referencing. One complication around cross-referencing is that, we need types to distinguish ambiguous names. For instance, both
syntax tableinst
andsyntax meminst
contains theTYPE
field. So, when we want to insert cross-reference toTYPE
in an expressionti.TYPE
, we need to know that the type ofti
istableinst
, notmeminst
. To disambiguate such cases in the prose backend, I have translated the types annotated in IL AST to AL on translation. So the prose backend was able to correctly insert a reference to the syntax definition oftableinst
fromTYPE
in expressionti.TYPE
.If we still want cross-references, and in the Latex backend, we need types for disambiguation. For now, I can think of two solutions,