| 1 |
= SXML |
| 2 |
|
| 3 |
<<SXML#>> is an <<IntermediateLanguage#>>, translated from <<XML#>> by |
| 4 |
<<Monomorphise#>>, optimized by <<SXMLSimplify#>>, and translated by |
| 5 |
<<ClosureConvert#>> to <<SSA#>>. |
| 6 |
|
| 7 |
== Description |
| 8 |
|
| 9 |
SXML is a simply-typed version of <<XML#>>. |
| 10 |
|
| 11 |
== Implementation |
| 12 |
|
| 13 |
* https://github.com/MLton/mlton/blob/master/mlton/xml/sxml.sig[`sxml.sig`] |
| 14 |
* https://github.com/MLton/mlton/blob/master/mlton/xml/sxml.fun[`sxml.fun`] |
| 15 |
* https://github.com/MLton/mlton/blob/master/mlton/xml/sxml-tree.sig[`sxml-tree.sig`] |
| 16 |
|
| 17 |
== Type Checking |
| 18 |
|
| 19 |
<<SXML#>> shares the type checker for <<XML#>>. |
| 20 |
|
| 21 |
== Details and Notes |
| 22 |
|
| 23 |
There are only two differences between <<XML#>> and <<SXML#>>. First, |
| 24 |
<<SXML#>> `val`, `fun`, and `datatype` declarations always have an |
| 25 |
empty list of type variables. Second, <<SXML#>> variable references |
| 26 |
always have an empty list of type arguments. Constructors uses can |
| 27 |
only have a nonempty list of type arguments if the constructor is a |
| 28 |
primitive. |
| 29 |
|
| 30 |
Although we could rely on the type system to enforce these constraints |
| 31 |
by parameterizing the <<XML#>> signature, <<StephenWeeks#>> did so in a |
| 32 |
previous version of the compiler, and the software engineering gains |
| 33 |
were not worth the effort. |