Permalink
Browse files

deyaccify, eliminate, horizontal: concrete syntax cleaned up

git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@776 ab42f6e0-554d-0410-b580-99e487e6eeb2
  • Loading branch information...
grammarware committed Feb 22, 2010
1 parent 1989dd9 commit fc96e230a50e0236e77adf6c3223e0a548aac69e
Showing with 304 additions and 233 deletions.
  1. +7 −3 shared/prolog/readXbgf.pro
  2. +19 −4 shared/xsd/xbgf.xsd
  3. +46 −2 topics/fl/lci/fl-lci.csproj
  4. +2 −2 topics/fl/lci/fl-lci.sln
  5. +6 −2 topics/fl/lci/xbgf/trim-jaxb.xbgf
  6. +3 −1 topics/fl/lci/xbgf/trim-om.xbgf
  7. +3 −1 topics/fl/lci/xbgf/trim-xsd.xbgf
  8. +1 −1 topics/java/lci/xbgf/correct-impl1.xbgf
  9. +3 −3 topics/java/lci/xbgf/correct-impl2.xbgf
  10. +2 −2 topics/java/lci/xbgf/correct-read1.xbgf
  11. +1 −1 topics/java/lci/xbgf/correct-read2.xbgf
  12. +1 −1 topics/java/lci/xbgf/correct-read3.xbgf
  13. +7 −7 topics/java/lci/xbgf/deyaccifyModifiers-read2.xbgf
  14. +3 −3 topics/java/lci/xbgf/deyaccifyStatements.xbgf
  15. +3 −3 topics/java/lci/xbgf/edit-read1.xbgf
  16. +3 −3 topics/java/lci/xbgf/edit-read2.xbgf
  17. +5 −5 topics/java/lci/xbgf/edit-read3.xbgf
  18. +18 −18 topics/java/lci/xbgf/editDeclarations.xbgf
  19. +9 −9 topics/java/lci/xbgf/editExpressions-jls1.xbgf
  20. +9 −9 topics/java/lci/xbgf/editExpressions-read2.xbgf
  21. +11 −11 topics/java/lci/xbgf/editExpressions-read3.xbgf
  22. +3 −3 topics/java/lci/xbgf/eliminate-read2.xbgf
  23. +3 −3 topics/java/lci/xbgf/extend-read12.xbgf
  24. +1 −1 topics/java/lci/xbgf/extendClassDeclarations.xbgf
  25. +3 −3 topics/java/lci/xbgf/extendExpressions.xbgf
  26. +2 −2 topics/java/lci/xbgf/extendInterfaceDeclarations.xbgf
  27. +1 −1 topics/java/lci/xbgf/extendModifiers.xbgf
  28. +1 −1 topics/java/lci/xbgf/generalize-impl3.xbgf
  29. +8 −8 topics/java/lci/xbgf/generalizeModifiers-read3.xbgf
  30. +1 −1 topics/java/lci/xbgf/generalizeNames-read1.xbgf
  31. +1 −1 topics/java/lci/xbgf/generalizeNames.xbgf
  32. +1 −1 topics/java/lci/xbgf/inlineForStatement.xbgf
  33. +7 −7 topics/java/lci/xbgf/inlineStatements.xbgf
  34. +1 −1 topics/java/lci/xbgf/refactor-impl1.xbgf
  35. +3 −3 topics/java/lci/xbgf/refactor-impl2.xbgf
  36. +4 −4 topics/java/lci/xbgf/refactor-impl3.xbgf
  37. +4 −4 topics/java/lci/xbgf/refactor-read1.xbgf
  38. +9 −9 topics/java/lci/xbgf/refactorClasses-read2.xbgf
  39. +6 −6 topics/java/lci/xbgf/refactorClasses-read3.xbgf
  40. +6 −6 topics/java/lci/xbgf/refactorDeclarations-read2.xbgf
  41. +7 −7 topics/java/lci/xbgf/refactorDeclarations-read3.xbgf
  42. +1 −1 topics/java/lci/xbgf/refactorEnums.xbgf
  43. +4 −4 topics/java/lci/xbgf/refactorExpressions.xbgf
  44. +3 −3 topics/java/lci/xbgf/refactorInterfaces-read2.xbgf
  45. +8 −8 topics/java/lci/xbgf/refactorInterfaces-read3.xbgf
  46. +2 −2 topics/java/lci/xbgf/refactorMinorMismatches.xbgf
  47. +2 −2 topics/java/lci/xbgf/refactorPackageNames.xbgf
  48. +14 −14 topics/java/lci/xbgf/refactorStatements-jls1.xbgf
  49. +3 −3 topics/java/lci/xbgf/refactorStatements-read3.xbgf
  50. +5 −5 topics/java/lci/xbgf/refactorTypes-jls1.xbgf
  51. +5 −5 topics/java/lci/xbgf/refactorTypes-read2.xbgf
  52. +9 −9 topics/java/lci/xbgf/refactorTypes-read3.xbgf
  53. +5 −5 topics/java/lci/xbgf/relaxClasses-read3.xbgf
  54. +9 −9 topics/java/lci/xbgf/relaxExpressions-read3.xbgf
View
@@ -64,7 +64,8 @@ xml2xbgf(T,unlabel(L))
xml2xbgf(T,deyaccify(N))
:-
self(name(xbgf:deyaccify),T),
content(T,N).
child(name(nonterminal),T,T1),
content(T1,N).
xml2xbgf(T,abstractize(P2))
:-
@@ -116,7 +117,8 @@ xml2xbgf(T,dump)
xml2xbgf(T,eliminate(N))
:-
self(name(xbgf:eliminate),T),
content(T,N).
child(name(nonterminal),T,T1),
content(T1,N).
xml2xbgf(T,G)
:-
@@ -149,8 +151,10 @@ xml2xbgf(T,G)
xml2xbgf(T,horizontal(N))
:-
self(name(xbgf:horizontal),T),
content(T,N).
child(name(nonterminal),T,T1),
content(T1,N).
% Unused / undocumented / deprecated ?
xml2xbgf(T,id)
:-
self(name(xbgf:id),T).
View
@@ -439,7 +439,7 @@
</xsd:complexType>
</xsd:element>
<xsd:element name="deyaccify" type="bgf:nonterminal">
<xsd:element name="deyaccify">
<xsd:annotation>
<xsd:documentation>
Deyaccification is a widely used term that means converting recursive
@@ -461,6 +461,11 @@
Both left- and right-recursive forms can be factored with this transformation.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="nonterminal" type="bgf:nonterminal"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="distribute">
@@ -493,7 +498,7 @@
<xsd:complexType/>
</xsd:element>
<xsd:element name="eliminate" type="bgf:nonterminal">
<xsd:element name="eliminate">
<xsd:annotation>
<xsd:documentation>
An unused definition (at most used within the definition itself)
@@ -504,6 +509,11 @@
a production of a vertical definition) is to be removed.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="nonterminal" type="bgf:nonterminal"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="extract">
@@ -592,13 +602,18 @@
</xsd:complexType>
</xsd:element>
<xsd:element name="horizontal" type="bgf:nonterminal">
<xsd:element name="horizontal">
<xsd:annotation>
<xsd:documentation>
Turn a definition based on multiple productions into a top choice-based one.
The action is a reverse of <ldf:keyword>vertical</ldf:keyword>.
The action is a reverse of <ldf:keyword>vertical</ldf:keyword>.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="nonterminal" type="bgf:nonterminal"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="inject">
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -10,8 +10,29 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>fl_lci</RootNamespace>
<AssemblyName>fl-lci</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -54,6 +75,7 @@
<None Include="..\..\..\shared\xsd\xbgf.xsd">
<Link>xbgf.xsd</Link>
</None>
<None Include="app.config" />
<None Include="fl.lcf" />
<None Include="xbgf\defineLex.xbgf" />
<None Include="xbgf\designateOps.xbgf" />
@@ -85,4 +107,26 @@
<None Include="xbgf\trim-xsd.xbgf" />
<None Include="xbgf\unerase.xbgf" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.VisualBasic.PowerPacks.10.0">
<Visible>False</Visible>
<ProductName>Microsoft Visual Basic PowerPacks 10.0</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
</Project>
View
@@ -1,6 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C# Express 2008
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "fl-lci", "fl-lci.csproj", "{9DF685A6-6572-47F9-8DE3-1E827BFDB62F}"
EndProject
Global
@@ -1,6 +1,10 @@
<xbgf:sequence xmlns:xbgf="http://planet-sl.org/xbgf">
<xbgf:eliminate>ObjectFactory</xbgf:eliminate>
<xbgf:eliminate>package-info</xbgf:eliminate>
<xbgf:eliminate>
<nonterminal>ObjectFactory</nonterminal>
</xbgf:eliminate>
<xbgf:eliminate>
<nonterminal>package-info</nonterminal>
</xbgf:eliminate>
<xbgf:rename>
<selector>
<from>EQUAL</from>
@@ -1,3 +1,5 @@
<xbgf:sequence xmlns:xbgf="http://planet-sl.org/xbgf">
<xbgf:eliminate>Visitor</xbgf:eliminate>
<xbgf:eliminate>
<nonterminal>Visitor</nonterminal>
</xbgf:eliminate>
</xbgf:sequence>
@@ -1,5 +1,7 @@
<xbgf:sequence
xmlns:bgf="http://planet-sl.org/bgf"
xmlns:xbgf="http://planet-sl.org/xbgf">
<xbgf:eliminate>Fragment</xbgf:eliminate>
<xbgf:eliminate>
<nonterminal>Fragment</nonterminal>
</xbgf:eliminate>
</xbgf:sequence>
@@ -9,6 +9,6 @@
</xbgf:reroot>
<!-- not used in other versions -->
<xbgf:eliminate>Goal</xbgf:eliminate>
<xbgf:eliminate><nonterminal>Goal</nonterminal></xbgf:eliminate>
</xbgf:sequence>
@@ -205,11 +205,11 @@
</xbgf:define>
<!-- ISSUE CORRECT SPECERROR unused non-terminal -->
<xbgf:eliminate>ArgumentsOpt</xbgf:eliminate>
<xbgf:eliminate><nonterminal>ArgumentsOpt</nonterminal></xbgf:eliminate>
<!-- ISSUE CORRECT SPECERROR unused non-terminal -->
<xbgf:eliminate>VoidMethodDeclaratorRest</xbgf:eliminate>
<xbgf:eliminate><nonterminal>VoidMethodDeclaratorRest</nonterminal></xbgf:eliminate>
<!-- ISSUE CORRECT SPECERROR unused non-terminal -->
<xbgf:eliminate>VariableDeclaratorsRest</xbgf:eliminate>
<xbgf:eliminate><nonterminal>VariableDeclaratorsRest</nonterminal></xbgf:eliminate>
<!-- undefine lexical term -->
<!-- GENERALITY -->
@@ -16,7 +16,7 @@
vs.
- [], ;([n(ConstantModifier), ,([n(ConstantModifiers), n(ConstantModifer)])])
-->
<xbgf:horizontal>ConstantModifiers</xbgf:horizontal>
<xbgf:horizontal><nonterminal>ConstantModifiers</nonterminal></xbgf:horizontal>
<xbgf:chain>
<bgf:production>
<nonterminal>ConstantModifiers</nonterminal>
@@ -103,7 +103,7 @@
,([t((), n(ReferenceType), t()), n(UnaryExpressionNotPlusMinus)]),
,([t((), n(PrimitiveType), ?(n(Dims)), t()), n(UnaryExpression)])])
-->
<xbgf:horizontal>CastExpression</xbgf:horizontal>
<xbgf:horizontal><nonterminal>CastExpression</nonterminal></xbgf:horizontal>
<xbgf:factor>
<bgf:expression>
<choice>
@@ -85,7 +85,7 @@
','([t('('), n('ReferenceType'), t(')'), n('UnaryExpressionNotPlusMinus')]),
','([t('('), n('PrimitiveType'), ?(n('Dims')), t(')'), n('UnaryExpression')])])),
-->
<xbgf:horizontal>CastExpression</xbgf:horizontal>
<xbgf:horizontal><nonterminal>CastExpression</nonterminal></xbgf:horizontal>
<xbgf:factor>
<bgf:expression>
<choice>
@@ -150,7 +150,7 @@
','([t('('), n('ReferenceType'), t(')'), n('UnaryExpressionNotPlusMinus')]),
','([t('('), n('PrimitiveType'), ?(n('Dims')), t(')'), n('UnaryExpression')])])),
-->
<xbgf:horizontal>CastExpression</xbgf:horizontal>
<xbgf:horizontal><nonterminal>CastExpression</nonterminal></xbgf:horizontal>
<xbgf:factor>
<bgf:expression>
<choice>
@@ -4,13 +4,13 @@
xmlns:xbgf="http://planet-sl.org/xbgf">
<!-- First the deyaccification -->
<xbgf:deyaccify>Modifiers</xbgf:deyaccify>
<xbgf:deyaccify>AbstractMethodModifiers</xbgf:deyaccify>
<xbgf:deyaccify>InterfaceModifiers</xbgf:deyaccify>
<xbgf:deyaccify>MethodModifiers</xbgf:deyaccify>
<xbgf:deyaccify>FieldModifiers</xbgf:deyaccify>
<xbgf:deyaccify>ConstructorModifiers</xbgf:deyaccify>
<xbgf:deyaccify>ConstantModifiers</xbgf:deyaccify>
<xbgf:deyaccify><nonterminal>Modifiers</nonterminal></xbgf:deyaccify>
<xbgf:deyaccify><nonterminal>AbstractMethodModifiers</nonterminal></xbgf:deyaccify>
<xbgf:deyaccify><nonterminal>InterfaceModifiers</nonterminal></xbgf:deyaccify>
<xbgf:deyaccify><nonterminal>MethodModifiers</nonterminal></xbgf:deyaccify>
<xbgf:deyaccify><nonterminal>FieldModifiers</nonterminal></xbgf:deyaccify>
<xbgf:deyaccify><nonterminal>ConstructorModifiers</nonterminal></xbgf:deyaccify>
<xbgf:deyaccify><nonterminal>ConstantModifiers</nonterminal></xbgf:deyaccify>
<!-- Getting rid of plurals altogether -->
<xbgf:inline>Modifiers</xbgf:inline>
@@ -9,7 +9,7 @@
vs.
- [], ;([n(SwitchBlockStatementGroup), ,([n(SwitchBlockStatementGroups), n(SwitchBlockStatementGroup)])])
-->
<xbgf:deyaccify>SwitchBlockStatementGroups</xbgf:deyaccify>
<xbgf:deyaccify><nonterminal>SwitchBlockStatementGroups</nonterminal></xbgf:deyaccify>
<xbgf:inline>SwitchBlockStatementGroups</xbgf:inline>
<xbgf:massage>
<bgf:expression>
@@ -50,14 +50,14 @@
vs.
- [], ;([n(CatchClause), ,([n(Catches), n(CatchClause)])])
-->
<xbgf:deyaccify>Catches</xbgf:deyaccify>
<xbgf:deyaccify><nonterminal>Catches</nonterminal></xbgf:deyaccify>
<!--
- Fail: BlockStatements.
- [], *(n(BlockStatement))
vs.
- [], ;([n(BlockStatement), ,([n(BlockStatements), n(BlockStatement)])])
-->
<xbgf:deyaccify>BlockStatements</xbgf:deyaccify>
<xbgf:deyaccify><nonterminal>BlockStatements</nonterminal></xbgf:deyaccify>
</xbgf:sequence>
@@ -37,8 +37,8 @@
vs.
- [], ,([t(import), n(PackageOrTypeName), t(.), t(*), t((;))])
-->
<xbgf:deyaccify>PackageName</xbgf:deyaccify>
<xbgf:deyaccify>PackageOrTypeName</xbgf:deyaccify>
<xbgf:deyaccify><nonterminal>PackageName</nonterminal></xbgf:deyaccify>
<xbgf:deyaccify><nonterminal>PackageOrTypeName</nonterminal></xbgf:deyaccify>
<xbgf:unfold>
<nonterminal>PackageName</nonterminal>
<in>
@@ -198,7 +198,7 @@
</bgf:production>
</vertical>
</xbgf:add>
<xbgf:horizontal>ClassInstanceCreationExpression</xbgf:horizontal>
<xbgf:horizontal><nonterminal>ClassInstanceCreationExpression</nonterminal></xbgf:horizontal>
<xbgf:factor>
<bgf:expression>
<choice>
@@ -16,8 +16,8 @@
<add>ConstructorBody</add>
<to>MethodBody</to>
</xbgf:unite>
<xbgf:eliminate>ExplicitConstructorInvocation</xbgf:eliminate>
<xbgf:eliminate>ArgumentList</xbgf:eliminate>
<xbgf:eliminate><nonterminal>ExplicitConstructorInvocation</nonterminal></xbgf:eliminate>
<xbgf:eliminate><nonterminal>ArgumentList</nonterminal></xbgf:eliminate>
<!-- ISSUE PERMISSIVENESS
Some productions use a more general QualifiedIdentifierList instead of TypeList
@@ -1410,7 +1410,7 @@
</bgf:expression>
</bgf:production>
</xbgf:disappear>
<xbgf:horizontal>ArrayInitializer</xbgf:horizontal>
<xbgf:horizontal><nonterminal>ArrayInitializer</nonterminal></xbgf:horizontal>
<xbgf:factor>
<bgf:expression>
<choice>
@@ -42,10 +42,10 @@
</xbgf:add>
<!-- finishing touches -->
<xbgf:eliminate>FormalParameterList</xbgf:eliminate>
<xbgf:eliminate>LastFormalParameter</xbgf:eliminate>
<xbgf:eliminate>NonWildTypeArguments</xbgf:eliminate>
<xbgf:eliminate>ReferenceTypeList</xbgf:eliminate>
<xbgf:eliminate>TypeDeclSpecifier</xbgf:eliminate>
<xbgf:eliminate><nonterminal>FormalParameterList</nonterminal></xbgf:eliminate>
<xbgf:eliminate><nonterminal>LastFormalParameter</nonterminal></xbgf:eliminate>
<xbgf:eliminate><nonterminal>NonWildTypeArguments</nonterminal></xbgf:eliminate>
<xbgf:eliminate><nonterminal>ReferenceTypeList</nonterminal></xbgf:eliminate>
<xbgf:eliminate><nonterminal>TypeDeclSpecifier</nonterminal></xbgf:eliminate>
</xbgf:sequence>
Oops, something went wrong.

0 comments on commit fc96e23

Please sign in to comment.