From 1274bec2dddc973a927a008685f3459621ea0d2d Mon Sep 17 00:00:00 2001 From: grammarware Date: Tue, 23 Sep 2008 00:22:45 +0000 Subject: [PATCH] matching nonterminals agree on their definitions! git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@296 ab42f6e0-554d-0410-b580-99e487e6eeb2 --- topics/java/jls2/collect.kw | 2 +- topics/java/lci/Makefile | 3 +- topics/java/lci/java.lcf | 5 + topics/java/lci/xbgf/breakSemantics2doc.xbgf | 183 ++++- .../java/lci/xbgf/deyaccifyExpressions.xbgf | 651 ++++++++++++++++++ topics/java/lci/xbgf/expandOps.xbgf | 68 ++ topics/java/lci/xbgf/fixErrors2.xbgf | 19 + topics/java/lci/xbgf/fixErrors2doc.xbgf | 42 ++ .../java/lci/xbgf/inlineExpressions2doc.xbgf | 256 ++++++- topics/java/lci/xbgf/preferLALR.xbgf | 23 - topics/java/lci/xbgf/prepare2.xbgf | 23 +- .../lci/xbgf/refactorClassDeclarations.xbgf | 442 ++++++++++++ .../lci/xbgf/refactorDeclarations2doc.xbgf | 317 ++++----- topics/java/lci/xbgf/refactorTypes.xbgf | 5 +- topics/java/lci/xbgf/unifyNames.xbgf | 63 ++ 15 files changed, 1893 insertions(+), 209 deletions(-) create mode 100644 topics/java/lci/xbgf/deyaccifyExpressions.xbgf create mode 100644 topics/java/lci/xbgf/expandOps.xbgf create mode 100644 topics/java/lci/xbgf/refactorClassDeclarations.xbgf create mode 100644 topics/java/lci/xbgf/unifyNames.xbgf diff --git a/topics/java/jls2/collect.kw b/topics/java/jls2/collect.kw index 7633463b..1e58c909 100644 --- a/topics/java/jls2/collect.kw +++ b/topics/java/jls2/collect.kw @@ -15,7 +15,7 @@ 8.1.5 8.3 8.3.1 -8.4/2 +8.4 8.4.1/2 8.4.3 8.4.4 diff --git a/topics/java/lci/Makefile b/topics/java/lci/Makefile index 5fae2535..e0b95815 100644 --- a/topics/java/lci/Makefile +++ b/topics/java/lci/Makefile @@ -6,7 +6,8 @@ diff2: test gdt bgf/jls1app.prepare1.refactorStatements.refactorTypes.structure1.addFeatures1to2.cropFeatures1.bgf bgf/jls2.prepare2.bgf diff: - ../../../shared/tools/gdt bgf/jls2syntax.fixErrors2.prepare2.bgf bgf/jls2doc.fixErrors2doc.unifyModifiers.deyaccify2doc.refactorTypes.inlineStatements2doc.inlineExpressions2doc.refactorDeclarations2doc.breakSemantics2doc.bgf + ../../../shared/tools/gdt bgf/jls2syntax.fixErrors2.prepare2.expandOps.bgf bgf/jls2doc.fixErrors2doc.unifyModifiers.unifyNames.deyaccify2doc.refactorTypes.deyaccifyExpressions.inlineStatements2doc.inlineExpressions2doc.refactorClassDeclarations.refactorDeclarations2doc.breakSemantics2doc.bgf + test: python ../../convergence/lci/lci.py java.lcf architecture diff --git a/topics/java/lci/java.lcf b/topics/java/lci/java.lcf index ccf4ade1..806ec65a 100644 --- a/topics/java/lci/java.lcf +++ b/topics/java/lci/java.lcf @@ -94,6 +94,7 @@ jls1doc + unifyNames preferLALR @@ -104,15 +105,19 @@ jls2syntax fixErrors2 prepare2 + expandOps jls2doc fixErrors2doc unifyModifiers + unifyNames deyaccify2doc refactorTypes + deyaccifyExpressions inlineStatements2doc inlineExpressions2doc + refactorClassDeclarations refactorDeclarations2doc breakSemantics2doc diff --git a/topics/java/lci/xbgf/breakSemantics2doc.xbgf b/topics/java/lci/xbgf/breakSemantics2doc.xbgf index 6b55c734..88bb7cf0 100644 --- a/topics/java/lci/xbgf/breakSemantics2doc.xbgf +++ b/topics/java/lci/xbgf/breakSemantics2doc.xbgf @@ -21,8 +21,8 @@ - - + ConstructorBody + + ConstructorBody + MethodBody + + + + + + TypeList + + + QualifiedIdentifierList + + + ConstructorDeclaratorRest + + + + + TypeList + + + QualifiedIdentifierList + + + MethodDeclaratorRest + + + + + + + MethodDeclaratorRest + + + + FormalParameters + + + BracketsOpt + + + + + + + throws + + + QualifiedIdentifierList + + + + + + + MethodBody + + + + + + + + MethodBody + + + + + MethodBody + + + ; + + + + + MethodDeclaratorRest + + + + + + + + + + + + + VariableInitializer + + + + + + + , + + + VariableInitializer + + + + + + + + + + + + + , + + + + + + + + + + + VariableInitializer + + + + + + + , + + + VariableInitializer + + + + + + + + + , + + + + + + + + + ArrayInitializer + + \ No newline at end of file diff --git a/topics/java/lci/xbgf/deyaccifyExpressions.xbgf b/topics/java/lci/xbgf/deyaccifyExpressions.xbgf new file mode 100644 index 00000000..d07dc881 --- /dev/null +++ b/topics/java/lci/xbgf/deyaccifyExpressions.xbgf @@ -0,0 +1,651 @@ + + + + + + + CastExpression + + + + CastExpression + + + + ( + + + + + Expression + + + Type + + + + + ) + + + UnaryExpression + + + + + + + + CastExpression + + + + ( + + + BasicType + + + + + Dims + + + + + ) + + + UnaryExpression + + + + + + + + CastExpression + + + + ( + + + QualifiedIdentifier + + + BracketsOpt + + + ) + + + UnaryExpressionNotPlusMinus + + + + + + CastExpression + + + PreIncrementExpression + PreDecrementExpression + UnaryExpressionNotPlusMinus + + UnaryExpression + + UnaryExpression + + + UnaryExpression + Expression3 + + + + + PostDecrementExpression + PostIncrementExpression + + PostfixExpression + + + + PostfixExpression + + QualifiedIdentifier + + + + + + PostfixExpression + + + + PostfixExpression + + + -- + + + + + + PostfixExpression + PostfixExpression + + + PostfixExpression + + + + Primary + + + + + Selector + + + + + + + ++ + + + + + + + + + + ++ + + + + + ++ + + + -- + + + + + PostfixExpression + + + + + Selector + + + + + + . + + + Identifier + + + + + Arguments + + + + + + + + + . + + + this + + + + + + + . + + + super + + + SuperSuffix + + + + + + + . + + + new + + + InnerCreator + + + + + + + [ + + + Expression + + + ] + + + + + + + + PostfixExpression + + Expression3 + + Expression3 + + + ConditionalOrExpression + + + ConditionalOrExpression + + + + Expression3 + + + + + Expression2Rest + + + + + + + + + + ConditionalOrExpression + Expression2 + + + + + Expression2Rest + + + + + + + + Infixop + + + Expression3 + + + + + + + + + Expression3 + + + instanceof + + + Type + + + + + + + + + + Infixop + + + + || + + + && + + + | + + + ^ + + + & + + + == + + + != + + + < + + + > + + + <= + + + >= + + + << + + + >> + + + >>> + + + + + + + - + + + * + + + / + + + % + + + + + + MultiplicativeExpression + AdditiveExpression + ShiftExpression + RelationalExpression + EqualityExpression + AndExpression + ExclusiveOrExpression + InclusiveOrExpression + ConditionalAndExpression + + + + + ConditionalExpression + + + + + Expression1Rest + + + + ? + + + Expression + + + : + + + ConditionalExpression + + + + + + + + ConditionalExpression + + + + Expression2 + + + Expression1Rest + + + + + + + + ConditionalExpression + + + + Expression2 + + + + + Expression1Rest + + + + + + + + + + + AssignmentExpression + + LeftHandSide + Assignment + + + AssignmentExpression + + Assignment + + + + ConditionalExpression + + + AssignmentExpression + Expression1 + + + + Expression1 + + + + + + + Expression + + + + Expression1 + + + + + + + AssignmentOperator + + + Expression1 + + + + + + + + + + + + StatementExpression + + + StatementExpression + + Expression + + + + \ No newline at end of file diff --git a/topics/java/lci/xbgf/expandOps.xbgf b/topics/java/lci/xbgf/expandOps.xbgf new file mode 100644 index 00000000..801d369c --- /dev/null +++ b/topics/java/lci/xbgf/expandOps.xbgf @@ -0,0 +1,68 @@ + + + PrefixOp + PostfixOp + + Expression3 + + Expression3 + + + + Expression1Rest + + + Expression1Rest + + + + ? + + + Expression + + + : + + + Expression1 + + + + + + + + + + + + Expression1Rest + + + + + + + + + Expression1Rest + + + + + + + + MemberDecl + + ClassBodyDeclaration + + + \ No newline at end of file diff --git a/topics/java/lci/xbgf/fixErrors2.xbgf b/topics/java/lci/xbgf/fixErrors2.xbgf index aa4aa240..da4da1f4 100644 --- a/topics/java/lci/xbgf/fixErrors2.xbgf +++ b/topics/java/lci/xbgf/fixErrors2.xbgf @@ -97,4 +97,23 @@ + + + + Expr + + + Expression + + + + + ArgumentsOpt \ No newline at end of file diff --git a/topics/java/lci/xbgf/fixErrors2doc.xbgf b/topics/java/lci/xbgf/fixErrors2doc.xbgf index ae5d44c9..814c7176 100644 --- a/topics/java/lci/xbgf/fixErrors2doc.xbgf +++ b/topics/java/lci/xbgf/fixErrors2doc.xbgf @@ -18,6 +18,12 @@ ConstantModifier + + + Identifer + Identifier + + + + + ClassName + + + + Identifier + + + + + AmbiguousName + + + . + + + Identifier + + + + + + + + + + + + ClassName + + + ClassName + + \ No newline at end of file diff --git a/topics/java/lci/xbgf/inlineExpressions2doc.xbgf b/topics/java/lci/xbgf/inlineExpressions2doc.xbgf index 93fd8f13..95c23479 100644 --- a/topics/java/lci/xbgf/inlineExpressions2doc.xbgf +++ b/topics/java/lci/xbgf/inlineExpressions2doc.xbgf @@ -26,7 +26,13 @@ PrimaryNoNewArray - + + ParExpression + + Expression3 + + + PrimaryNoNewArray + FieldAccess Primary @@ -215,7 +222,7 @@ StatementExpressionList - + VariableInitializers - VariableInitializers + VariableInitializers VariableDeclarators - + + + + + + + . + + + this + + + + + + + IdentifierSuffix + + + + + Primary + + + + + IdentifierSuffix + + + + + + [ + + + + + + + ] + + + BracketsOpt + + + . + + + class + + + + + + + Expression + + + ] + + + + + + + + + Arguments + + + + + . + + + + + class + + + this + + + + + super + + + Arguments + + + + + + + new + + + InnerCreator + + + + + + + + + + + + + + + + SuperSuffix + + + + . + + + Identifier + + + + + + Primary + + + + + SuperSuffix + + + + . + + + Identifier + + + + + Arguments + + + + + + + + + + SuperSuffix + + Arguments + + + + SuperSuffix + + + + + Primary + + ArrayAccess + + + + + + Primary + + MethodInvocation + + + + + + Primary + + ClassInstanceCreationExpression + + + + + + Primary + + + + Primary + + + SuperSuffix + + + + + + + + Primary + + + + QualifiedIdentifier + + + . + + + super + + + SuperSuffix + + + + + + Primary \ No newline at end of file diff --git a/topics/java/lci/xbgf/preferLALR.xbgf b/topics/java/lci/xbgf/preferLALR.xbgf index bc931845..7b330909 100644 --- a/topics/java/lci/xbgf/preferLALR.xbgf +++ b/topics/java/lci/xbgf/preferLALR.xbgf @@ -13,29 +13,6 @@ Statement - - - AmbiguousName - Name - - - - - MethodName - Name - - - TypeName - Name - - - PackageName - Name - - - ExpressionName - Name - + + + + + ClassOrInterfaceDeclaration + + + + ClassDeclaration + + + InterfaceDeclaration + + + + + + + + + + ClassOrInterfaceDeclaration + + + + ModifiersOpt + + + + + ClassDeclaration + + + InterfaceDeclaration + + + + + + + + + + ClassBodyDeclarations + ClassBodyDeclarations + + + + + + + ClassBodyDeclaration + + + + + + + + + ClassBodyDeclaration + + + + + + + + + ClassDeclaration + + + + class + + + Identifier + + + + + Super + + + + + + + Interfaces + + + + + ClassBody + + + + + + Super + Interfaces + + + + ClassMemberDeclaration + InstanceInitializer + StaticInitializer + ConstructorDeclaration + MethodDeclaration + ConstructorDeclarator + ResultType + MethodHeader + + ClassBodyDeclaration + + + + + + ClassBodyDeclaration + + Block + + + + + + ClassBodyDeclaration + + + + static + + + Block + + + + + + + + ClassBodyDeclaration + + + + + + static + + + + + Block + + + + + + + + + + FormalParameters + + + + ( + + + + + FormalParameterList + + + + + ) + + + + + + FormalParameterList + FormalParameterList + + SimpleTypeName + Identifier + + + + ConstructorDeclaratorRest + + + + FormalParameters + + + + + Throws + + + + + ConstructorBody + + + + + + + + MethodDeclarator + + + MethodDeclaratorRest + + + + FormalParameters + + + + + Throws + + + + + MethodBody + + + + + + + + MethodOrFieldDecl + + + + Type + + + Identifier + + + MethodDeclaratorRest + + + + + + + + MethodOrFieldRest + + MethodDeclaratorRest + + + + MethodOrFieldDecl + + + + + MethodOrFieldRest + + VariableDeclaratorRest + + + + + + VariableDeclaratorRest + + + + BracketsOpt + + + + + + + = + + + VariableInitializer + + + + + + + + + + MethodOrFieldRest + + + + + ClassBodyDeclaration + + ClassOrInterfaceDeclaration + + + + + + + ClassBodyDeclaration + + + + ModifiersOpt + + + ClassOrInterfaceDeclaration + + + + + + + + + + + + ClassBodyDeclaration + + FieldDeclaration + + + + + Throws + + \ No newline at end of file diff --git a/topics/java/lci/xbgf/refactorDeclarations2doc.xbgf b/topics/java/lci/xbgf/refactorDeclarations2doc.xbgf index 51c5d801..144852ca 100644 --- a/topics/java/lci/xbgf/refactorDeclarations2doc.xbgf +++ b/topics/java/lci/xbgf/refactorDeclarations2doc.xbgf @@ -2,86 +2,6 @@ xmlns:bgf="http://planet-sl.org/bgf" xmlns:xbgf="http://planet-sl.org/xbgf"> - - - - ClassOrInterfaceDeclaration - - - - ClassDeclaration - - - InterfaceDeclaration - - - - - - - - - - ClassOrInterfaceDeclaration - - - - ModifiersOpt - - - - - ClassDeclaration - - - InterfaceDeclaration - - - - - - - - - - ClassBodyDeclarations - ClassBodyDeclarations - - - - - - - ClassBodyDeclaration - - - - - - - - - ClassBodyDeclaration - - - - - - - - ClassDeclaration - - - - class - - - Identifier - - - - - Super - - - - - - - Interfaces - - - - - ClassBody - - - - - - Super - Interfaces - - + PackageDeclaration - PackageName - - PackageName - QualifiedIdentifier - ImportDeclarations ImportDeclarations @@ -366,9 +217,163 @@ TypeImportOnDemandDeclaration + + + + ImportDeclaration + + + + ImportDeclaration + + + + import + + + QualifiedIdentifier + + + . + + + * + + + ; + + + + + + + + ImportDeclaration + + + + import + + + QualifiedIdentifier + + + + + + + . + + + * + + + + + + + ; + + + + + + + + + InterfaceBodyDeclaration + + + InterfaceBodyDeclaration + + + + ; + + + + + ModifiersOpt + + + InterfaceMemberDecl + + + + + + + + + + InterfaceMemberDecl + + + + InterfaceMethodOrFieldDecl + + + + + void + + + Identifier + + + VoidInterfaceMethodDeclaratorRest + + + + + ClassOrInterfaceDeclaration + + + + + + + + ArgumentList + + + Arguments + + + + ( + + + + + ArgumentList + + + + + ) + + + + + + ArgumentList + + \ No newline at end of file diff --git a/topics/java/lci/xbgf/refactorTypes.xbgf b/topics/java/lci/xbgf/refactorTypes.xbgf index 747061bc..032372e0 100644 --- a/topics/java/lci/xbgf/refactorTypes.xbgf +++ b/topics/java/lci/xbgf/refactorTypes.xbgf @@ -84,11 +84,11 @@ - + @@ -197,7 +197,6 @@ - TypeName ClassOrInterfaceType ClassType ReferenceType diff --git a/topics/java/lci/xbgf/unifyNames.xbgf b/topics/java/lci/xbgf/unifyNames.xbgf new file mode 100644 index 00000000..4cc74361 --- /dev/null +++ b/topics/java/lci/xbgf/unifyNames.xbgf @@ -0,0 +1,63 @@ + + + + + + AmbiguousName + QualifiedIdentifier + + + + MethodName + QualifiedIdentifier + + + TypeName + QualifiedIdentifier + + + PackageName + QualifiedIdentifier + + + PackageOrTypeName + QualifiedIdentifier + + + ExpressionName + QualifiedIdentifier + + + ClassName + QualifiedIdentifier + + QualifiedIdentifier + + \ No newline at end of file