rupesh4514 / grammatical-framework

Automatically exported from code.google.com/p/grammatical-framework
0 stars 0 forks source link

extending incomplete grammars #75

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I need to create a concrete grammar which is both incomplete (i.e. uses an 
interface that should be instantiated), and need to be extended. Here is a 
simple example:

abstract abs = {
flags startcat = Action ;
cat Action ;
cat Item;
data Action_Item: Item -> Action ;
data Item_Lamp: Item;
};

interface ifc = {
oper mkAction: {s: Str} -> {s: Str};
};

incomplete concrete cnc of abs = open ifc in {
lincat Action = {s: Str};
lincat Item = {s : Str} ;
lin Action_Item x = mkAction x;
};

incomplete concrete cncext of abs = cnc ** {
lin Item_Lamp = {s = "lamp"};
};

instance inst1 of ifc = {
oper mkAction: {s: Str} -> {s: Str} = \x -> {s = "get the" ++ x.s};
};

instance inst2 of ifc = {
oper mkAction: {s: Str} -> {s: Str} = \x -> {s = "put the "++x.s};
};

concrete cnc1 of abs = cncext with (ifc =inst1);

concrete cnc2 of abs = cncext with (ifc =inst2);

When I compile cnc1, I get this:

compiling /home/erelsgl/workspace/gf_​java_api/interface_test/abs.​gf... 
write file /home/erelsgl/workspace/gf_​java_api/interface_test/abs.​gfo
compiling /home/erelsgl/workspace/gf_​java_api/interface_test/ifc.​gf... 
write file /home/erelsgl/workspace/gf_​java_api/interface_test/ifc.​gfo
compiling /home/erelsgl/workspace/gf_​java_api/interface_test/cnc.​gf... 
write file /home/erelsgl/workspace/gf_​java_api/interface_test/cnc.​gfo
compiling /home/erelsgl/workspace/gf_​java_api/interface_test/​cncext.gf... 
write file /home/erelsgl/workspace/gf_​java_api/interface_test/​cncext.gfo
compiling /home/erelsgl/workspace/gf_​java_api/interface_test/inst1.​gf... 
write file /home/erelsgl/workspace/gf_​java_api/interface_test/inst1.​gfo
compiling /home/erelsgl/workspace/gf_​java_api/interface_test/cnc1.​gf... 
/home/erelsgl/workspace/gf_​java_api/interface_test/cnc1.​gf: Warning: no 
linearization type for Action, inserting default {s : Str} Warning: no 
linearization of Action_Item Warning: no linearization type for Item, inserting 
default {s : Str} write file 
/home/erelsgl/workspace/gf_​java_api/interface_test/cnc1.​gfo
and there are no trees:

abs> gt
no trees found
0 msec

However, when I merge cncext into cnc, it works.

Is this a bug, or am I doing something wrong?

Original issue reported on code.google.com by gregoire...@gmail.com on 27 Aug 2013 at 1:24