tricu

An interpreted language for exploring Tree Calculus
Log | Files | Refs | README | LICENSE

sourceGateCompiler.tri (1219B)


      1 !import "prelude"        !Local
      2 !import "source.compile" !Local
      3 
      4 -- Single-unit feasibility artifact. The full entrypoint also accepts an
      5 -- environment; this executable binds an empty environment for host shells
      6 -- that pass only source strings on the command line.
      7 main = (source : compileGateSource [] source)
      8 
      9 -- Expected is an independently constructed Result Tree Diagnostic, supplied
     10 -- as a separate Arboricx artifact by each host. The comparison forces all
     11 -- returned fields despite Zig's weak-head-normal-form public reducer.
     12 matchesExpected = (source expected :
     13   equal? (compileGateSource [] source) expected)
     14 
     15 -- Host-side conformance probe: force both compiler results by comparing their
     16 -- trees inside tricu. This yields a small boolean even on WHNF-only reducers.
     17 conforms = (source expectedSource :
     18   matchResult
     19     (diagnostic rest :
     20       matchResult
     21         (expectedDiagnostic expectedRest : equal? diagnostic expectedDiagnostic)
     22         (_ _ : false)
     23         (compileGateSource [] expectedSource))
     24     (value rest :
     25       matchResult
     26         (_ _ : false)
     27         (expected expectedRest : equal? value expected)
     28         (compileGateSource [] expectedSource))
     29     (compileGateSource [] source))