I have a syntax definition with a proper pp file, and all installs fine. But when using the prettyprinter (abox2text) on a parsed example file, I receive an error. (All occurs in my TFOF package)

Example file:

module datatypes
types
data List a = Cons a (List a)
| Nil

(relevant part of) SDF:

 "data" ConId TypeVarId*
    "=" {(ConId  Type*) "|"}+     -> TypeDef {cons("DataType")}

(Note the ConId Type* grouped to form the first argument of the iter-sep.

pp-rules (equal to pp-gen output, but enhanced by hand):

DataType               -- H [KW["data"] _1 _2 H [KW["="] V[_3]]],
DataType.2:iter-star   -- _1,
DataType.3:iter-sep    -- H [_1 KW["|"]],
DataType.3:iter-sep.1:seq             -- H hs=1[_1 _2],
DataType.3:iter-sep.1:seq.2:iter-star -- _1,

Now running the pretty-printer on the (correctly-parsed) example file produces:
$ parse-tfof -i xmpl/datatypes.tfmd | ast2abox -p pp/TFOF-pretty.pp | abox2text
No pp entry found for: (2,[""])
** ERROR: cannot rewrite to box: (“Nil”,[])
ast2abox: rewriting failed

Apparently the :seq pp-rule is not (properly) used.
A fix for now is to have in my SDF:

 ConId  Type*          -> TypeKind {cons("TypeKind")}
 "data" ConId TypeVarId*
   "=" {TypeKind "|"}+     -> TypeDef {cons("DataType")}

The two :seq entries can be left out of the pp file now, an all works fine. But it still seems like tuples should be supported.

Submitted on 4 May 2004 at 15:43

Log in to post comments