With the grammar:

exports

context-free start-symbols
Start

context-free syntax

"module" ID Gal-expr       -> Start {cons("Module")}


(Unit-decl ".")*				-> Gal-expr {cons("GalExpr")}

Unit-type-name Unit-type-def	-> Unit-decl {cons("UnitDecl")}

ID								-> Unit-type-name {cons("UnitTypeName")}    
"a" "gal:unit" ";" Content	
	-> Unit-type-def {cons("UnitTypeDef")}

"gal:contains" "(" ( "[" ( "Attr-def" ) "]" )* ")" 
	-> Content {cons("Content")}


I get “build.generated.xml:267: Java returned 1”
While changing the last rule to:

“gal:contains” “(” ( “[" ( Attr-def ) "]” )* “)”
-> Content {cons(“Content”)}

or

“gal:contains” “(” ( “[" ( “Attr-def” ID ) "]” )* “)”
-> Content {cons(“Content”)}

(with Attr-def defined of course)

I get no errors.

Submitted by Tim on 12 May 2010 at 14:43

On 12 May 2010 at 14:46 Lennart Kats commented:

Interesting, sdf2rtg creates the following RTG for this:


regular tree grammar
start Start
productions
21 -> <(0)>()
ListStarOf1 -> ListPlusOf1
ListStarOf1 -> ()
ListStarOf1 -> (ListStarOf1,ListStarOf1)
ListPlusOf1 -> (ListStarOf1,ListPlusOf1)
ListPlusOf1 -> (ListPlusOf1,ListStarOf1)
ListPlusOf1 -> (ListPlusOf1,ListPlusOf1)
ListPlusOf1 -> (21,ListStarOf1)
Unit-decl1 -> <(1)>(Unit-decl)

Which causes rtg2sig to generate the following Stratego signature:


module Delme

signature
constructors
: 21
: Unit-decl -> Unit-decl1
Content : List(21) -> Content
UnitTypeDef : Content -> Unit-type-def
UnitTypeName : ID -> Unit-type-name
UnitDecl : Unit-type-name * Unit-type-def -> Unit-decl
GalExpr : List(Unit-decl1) -> Gal-expr
Module : ID * Gal-expr -> Start
: String -> ID

And this 21 constructor makes no sense and causes the Stratego parser to fail.

(Note: for now, I’ll have the Spoofax SDF editor report this as an error.)


On 17 May 2010 at 17:11 Rob Vermaas commented:

Should be fixed in r.20851.

In case of only literals in a sequence, Symbol2String from sdf2rtg returned empty string. Added case for this situation.

Log in to post comments