tool sglr is { command = "/opt/local/bin/sglr" }

process SGLR is
let
  SGLR: sglr,
  Error: term,
  Heuristics: term,
  Input: str,
  ParseForest: term,
  ParseTable: term,
  ParseTree: term,
  TopSort: str
in
  (
    rec-msg(sglr-parse(Input?, ParseTable?, TopSort?, Heuristics?))
    . execute(sglr, SGLR?)
    . snd-eval(SGLR, parse(Input, ParseTable, TopSort, Heuristics))
    .
    (
      (
        rec-value(SGLR, parse-tree(ParseTree?))
        . snd-msg(sglr-parse-tree(ParseTree))
      +
        rec-value(SGLR, parse-forest(ParseForest?, Error?))
 	. shutdown("THIS CODE IS DEAD\n")
        . snd-msg(sglr-parse-forest(ParseForest, Error))
      +
        rec-value(SGLR, parse-error(Error?))
        . snd-msg(sglr-parse-error(Error))
      )
      . snd-terminate(SGLR, "done")
    +
      rec-disconnect(SGLR)
      . snd-msg(sglr-parse-error(error("the SGLR parser was aborted",[subject("file")])))
    )
  ) * delta
endlet

toolbus(SGLR)
