Skip to content

Commit

Permalink
deyaccify, eliminate, horizontal: concrete syntax cleaned up
Browse files Browse the repository at this point in the history
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 fc96e23
Show file tree
Hide file tree
Showing 54 changed files with 304 additions and 233 deletions.
10 changes: 7 additions & 3 deletions shared/prolog/readXbgf.pro
Expand Up @@ -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))
:-
Expand Down Expand Up @@ -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)
:-
Expand Down Expand Up @@ -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).
Expand Down
23 changes: 19 additions & 4 deletions shared/xsd/xbgf.xsd
Expand Up @@ -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
Expand All @@ -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">
Expand Down Expand Up @@ -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)
Expand All @@ -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">
Expand Down Expand Up @@ -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">
Expand Down
48 changes: 46 additions & 2 deletions topics/fl/lci/fl-lci.csproj
@@ -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>
Expand All @@ -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>
Expand Down Expand Up @@ -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" />
Expand Down Expand Up @@ -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>
4 changes: 2 additions & 2 deletions topics/fl/lci/fl-lci.sln
@@ -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
Expand Down
8 changes: 6 additions & 2 deletions topics/fl/lci/xbgf/trim-jaxb.xbgf
@@ -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>
Expand Down
4 changes: 3 additions & 1 deletion topics/fl/lci/xbgf/trim-om.xbgf
@@ -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>
4 changes: 3 additions & 1 deletion topics/fl/lci/xbgf/trim-xsd.xbgf
@@ -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>
2 changes: 1 addition & 1 deletion topics/java/lci/xbgf/correct-impl1.xbgf
Expand Up @@ -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>
6 changes: 3 additions & 3 deletions topics/java/lci/xbgf/correct-impl2.xbgf
Expand Up @@ -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 -->
Expand Down
4 changes: 2 additions & 2 deletions topics/java/lci/xbgf/correct-read1.xbgf
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion topics/java/lci/xbgf/correct-read2.xbgf
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion topics/java/lci/xbgf/correct-read3.xbgf
Expand Up @@ -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>
Expand Down
14 changes: 7 additions & 7 deletions topics/java/lci/xbgf/deyaccifyModifiers-read2.xbgf
Expand Up @@ -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>
Expand Down
6 changes: 3 additions & 3 deletions topics/java/lci/xbgf/deyaccifyStatements.xbgf
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
6 changes: 3 additions & 3 deletions topics/java/lci/xbgf/edit-read1.xbgf
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
6 changes: 3 additions & 3 deletions topics/java/lci/xbgf/edit-read2.xbgf
Expand Up @@ -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
Expand Down Expand Up @@ -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>
Expand Down
10 changes: 5 additions & 5 deletions topics/java/lci/xbgf/edit-read3.xbgf
Expand Up @@ -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>

0 comments on commit fc96e23

Please sign in to comment.