Stratego/XT JIRA  History | Log In     View a printable version of the current page. Get help!  
Issue Details (XML | Word)

Key: STR-26
Type: Bug Bug
Status: Closed Closed
Resolution: Won't Fix
Priority: Major Major
Assignee: Unassigned
Reporter: Arthur van Dam
Votes: 0
Watchers: 0
Operations

Clone this issue
Create sub-task
If you were logged in you would be able to see more operations.
Stratego/XT

implode-asfix doesn't support 'iter-n' nor 'iter-sep-n'

Created: 2004-03-21 10:51   Updated: 2008-03-31 20:39
Component/s: asfix-tools
Affects Version/s: 0.9.5
Fix Version/s: 0.10

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
Environment: strategoxt-r5522


 Description  « Hide
The iter-n and iter-n-sep patterns in SDF cannot be imploded by implode-asfix.
Consider the following definition niter-test.sdf :
----
module niter-test
exports
  sorts Foo Bar

lexical syntax
    [\ \t\13\n] -> LAYOUT
    "foo" -> Foo

context-free syntax
    "(" {Foo ","}2+ ")" -> Bar {cons("TwoOrMore")}
    "(" {Foo ","}+ ")" -> Bar {cons("OneOrMore")}

context-free restrictions
    LAYOUT? -/- [\ \t\13\n]

context-free priorities
    "(" {Foo ","}2+ ")" -> Bar
  > "(" {Foo ","}+ ")" -> Bar
----

and an example file: test.nit
----
(foo, foo)
----

packing and table-generation goes fine, but when running
$ sglri -i test.nit -p niter-test.tbl | pp-aterm
or
$ sglr -i test.nit -p niter-test.tbl -2 | implode-asfix |
pp-aterm

the following output is produced:
----
TwoOrMore(
  appl(
    prod(
      [ cf(sort("Foo"))
      , cf(opt(layout))
      , lit(",")
      , cf(opt(layout))
      , cf(iter-sep(sort("Foo"), lit(",")))
      ]
    , cf(iter-sep-n(sort("Foo"), lit(","), 2))
    , no-attrs
    )
  , ["foo", None, lit(","), Some(" "), ["foo"]]
  )
)
----

When the 2+ production is left out, all parsing into the 'OneOrMore' constructor goes just fine. I also tried an 1+ pattern, but this is desugared into a normal + in some earlier stage.
And, as said: the above also fails for the iter-n (w/o separator)

 All   Comments   Work Log   Change History      Sort Order:
Arthur van Dam [2004-03-21 13:55]
In asfix-tools/src/implode/implode-asfix.str iter-n and iter-sep-n are indeed left out, except for one occurrence each:

implode-lexical =
 ...
    //<+ ?appl(prod(_,varsym(cf(iter-n(_))),_),_); !meta-listvar(<yield>)
    //<+ ?appl(prod(_,varsym(cf(iter-sep-n(_,_))),_),_); !meta-listvar(<yield>)

Both lines were introduced 18 months ago by Eelco (lines 237-238, see:
http://cvs.cs.uu.nl/cgi-bin/cvsweb.cgi/XT-OLD/asfix-tools/src/implode/implode-asfix.r?annotate=1.13 ), but they have always been commented, I don't know the reason for that.

Martin Bravenboer [2004-03-26 11:51]
iter-n' nor 'iter-sep-n' will no longer be available in future versions of SDF. It is not worth the effort to fix it in implode-asfix. Please avoid iter-n and iter-sep-n.