Closed suweining closed 9 years ago
//////////////////////////////////////////////////////////////////Ambiguity1)///////////////////////////////////////////////////////////////////////////////
1: PpeListValue ::= MBracketLeft PpeExpressionWithoutBooleanTerm MBracketRight
2: AmbBracketLeftIdBracketRight ::= MBracketLeft Id MBracketRight
in Devices.aadl
/////////////////////////////////////////////// Solution ////////////////////////////////////////////
It is clearly that the ambiguity is " MBracketLeft Id MBracketRight" So,firstly,we shall locate the ambiguity in the PpeListValue. The location of PpeListValue is just the location of " PpeExpressionWithoutBooleanTerm => Id " So the first step is get the location of " PpeExpressionWithoutBooleanTerm => Id ".
step1)
syntax PpeListValue ::= MBracketLeft MBracketRight | MBracketLeft PpeListValue MBracketRight | MBracketLeft PpeListValue MComma PpeListValueMidSymbol MBracketRight | MBracketLeft PpeExpression MComma PpeListValueMidSymbol MBracketRight | MBracketLeft PpeExpressionWithoutBooleanTerm MBracketRight | AmbBracketLeftBooleanTermBracketRight
syntax PpeExpressionWithoutBooleanTerm ::= RealTerm | IntegerTerm | StringTerm | EnumerationTerm | UnitTerm | RealRangeTerm | IntegerRangeTerm | PpeTerm | CmpClassifierTerm | RefTerm | RecordTerm | ComputedTerm
//////////////////////////////// RealTerm (yes) /////////////////////////////////// syntax RealTerm ::= SignedAadlrealOrConstant syntax SignedAadlrealOrConstant ::= SignedAadlreal | RealPpeConstantTerm | Sign RealPpeConstantTerm
syntax RealPpeConstantTerm ::= PpeConstantTerm syntax PpeConstantTerm ::= AmbDoubleColonId syntax AmbDoubleColonId ::= Id | Id MDoubleColon Id
//////////////////////////////// IntegerTerm (no) /////////////////////////////////// syntax IntegerTerm ::= SignedAadlintegerOrConstant syntax SignedAadlintegerOrConstant ::= SignedAadlinteger | IntegerPpeConstantTerm | Sign IntegerPpeConstantTerm
syntax SignedAadlinteger ::= Sign IntegerLiteral Id | Sign IntegerLiteral | IntegerLiteral Id | IntegerLiteral syntax IntegerLiteral ::= Int
//////////////////////////////// StringTerm (yes) /////////////////////////////////// syntax StringTerm ::= StringLiteral | StringPpeConstantTerm
syntax StringPpeConstantTerm ::= PpeConstantTerm syntax PpeConstantTerm ::= AmbDoubleColonId syntax AmbDoubleColonId ::= Id | Id MDoubleColon Id //////////////////////////////// EnumerationTerm (yes) /////////////////////////////////// syntax EnumerationTerm ::= EnumerationId | EnumerationPpeConstantTerm
syntax EnumerationPpeConstantTerm ::= PpeConstantTerm syntax PpeConstantTerm ::= AmbDoubleColonId syntax AmbDoubleColonId ::= Id | Id MDoubleColon Id
//////////////////////////////// UnitTerm [mark]/////////////////////////////////// syntax UnitTerm ::= Id | UnitPpeConstantTerm
syntax UnitPpeConstantTerm ::= PpeConstantTerm syntax PpeConstantTerm ::= AmbDoubleColonId syntax AmbDoubleColonId ::= Id | Id MDoubleColon Id //////////////////////////////// RealRangeTerm (yes) /////////////////////////////////// syntax RealRangeTerm ::= RealRange | RealTerm MDoubleDiont RealTerm Mdelta RealTerm | RealRangePpeConstantTerm
syntax RealRangePpeConstantTerm ::= PpeConstantTerm syntax PpeConstantTerm ::= AmbDoubleColonId syntax AmbDoubleColonId ::= Id | Id MDoubleColon Id //////////////////////////////// IntegerRangeTerm (yes) /////////////////////////////////// syntax IntegerRangeTerm ::= AmbSignedAadlintegerOrConstantDoubleDiontSignedAadlintegerOrConstant | IntegerTerm MDoubleDiont IntegerTerm Mdelta IntegerTerm | IntegerRangePpeConstantTerm
syntax IntegerRangePpeConstantTerm ::= PpeConstantTerm syntax PpeConstantTerm ::= AmbDoubleColonId syntax AmbDoubleColonId ::= Id | Id MDoubleColon Id
//////////////////////////////// PpeTerm [mark]/////////////////////////////////// syntax PpeTerm ::= AmbDoubleColonId syntax AmbDoubleColonId ::= Id | Id MDoubleColon Id
//////////////////////////////// CmpClassifierTerm (no)/////////////////////////////////// syntax CmpClassifierTerm ::= AmbClassifierBracketLeftIdBracketRight | Mclassifier MBracketLeft Id MDoubleColon PkgName MBracketRight | Mclassifier MBracketLeft PkgName MDoubleColon Id MBracketRight
//////////////////////////////// RefTerm (no)///////////////////////////////////
syntax RefTerm ::= Mreference MBracketLeft AnnexPath MBracketRight | Mreference MBracketLeft ContainedModelElementList AnnexPath MBracketRight | Mreference MBracketLeft ContainedModelElement MPoint ContainedModelElementList MBracketRight | Mreference MBracketLeft NamedElementArraySelectionName MBracketRight | AmbReferenceBracketLeftIdBracketRight
//////////////////////////////// RecordTerm (no)///////////////////////////////////
syntax RecordTerm ::= MBracketLeft RecordFieldIdIdList MBracketRight
//////////////////////////////// ComputedTerm (no)///////////////////////////////////
syntax ComputedTerm ::= Mcompute MBracketLeft Id MBracketRight
step2)
We find that the PpeTerm and UnitTerm can get Id directly.
So We try to alter PpeTerm and UnitTerm :
syntax PpeTerm ::= Id MDoubleColon Id syntax UnitTerm ::= UnitPpeConstantTerm
If no good Should change the defination of PpeConstantTerm
syntax PpeConstantTerm ::= AmbDoubleColonId syntax AmbDoubleColonId ::= Id | Id MDoubleColon Id
Kompile and Krun ,and Error05 1.1) appear
Error05 1.1)
UniFetGroupTypeRef, AmbDoubleColonId, PpeTerm, PkgName in in Devices.aadl
/////////////////////////////////// Ambigutiy 1.1) //////////////////////////////////////////////////////
syntax UniFetGroupTypeRef ::= Id | PkgName MDoubleColon Id
syntax AmbDoubleColonId ::= Id | Id MDoubleColon Id
syntax PpeTerm ::= Id MDoubleColon Id
syntax PkgName ::= Id | Id MDoubleColon PkgName
/////////////////////////////////////// Solution /////////////////////////////////////////////////
syntax PpeTerm ::= Id MDoubleColon Id
syntax AmbDoubleColonId ::= Id | PpeTerm
syntax UniFetGroupTypeRef ::= PkgName
syntax PkgName ::= AmbDoubleColonId | Id MDoubleColon Id MDoubleColon PkgName
Kompile and Krun ,and Error05 1.2) appear
Error05 1.2) (1) [Error] Critical: Parse error: Syntax error near unexpected character ';' File: ../tests/unit/FeatureGroupConnections.aadl Location: (21,30,21,30) (2) Exception in thread "main" java.lang.AssertionError: The greatest lower bound (GLB) of sorts [PpeConstantTerm, PpeTerm]doesn't exist!
////////////////////////////// Solution Error05 1.2 (1)///////////////////////////////////////// Locate the syntax of Error(1) :
syntax PpeValue ::= SinglePpeValue | PpeListValue syntax SinglePpeValue ::= PpeExpression syntax PpeExpression ::= BooleanTerm | RealTerm | IntegerTerm | StringTerm | EnumerationTerm | UnitTerm | RealRangeTerm | IntegerRangeTerm | PpeTerm | CmpClassifierTerm | RefTerm | RecordTerm | ComputedTerm
While eliminate Error05 1),we delete Id from PpeConstantTerm,PpeTerm and UnitTerm.These changes result in the defination of
PpeExpression lack of Id.So The defination of PpeValue lack of a "Id" :
syntax PpeValue ::= SinglePpeValue | PpeListValue | Id
////////////////////////////// Solution Error05 1.2(2)/////////////////////////////////////////
syntax PpeTerm ::= Id MDoubleColon Id syntax PpeConstantTerm ::= Id MDoubleColon Id
step1) syntax AmbIdDoubleColonId ::= Id MDoubleColon Id
step2) syntax PpeTerm ::= AmbIdDoubleColonId
step3) syntax PpeConstantTerm ::= AmbIdDoubleColonId
Unsolved Ambiguity 1)
[0, 3.366 ms] [Warning] Inner Parser: Parsing ambiguity. Arbitrarily choosing the first. 1: PpeListValue ::= MBracketLeft PpeExpressionWithoutBooleanTerm MBracketRight ( TemperatureSensorHardwareModel ) 2: AmbBracketLeftIdBracketRight ::= MBracketLeft Id MBracketRight ( TemperatureSensorHardwareModel ) File: ../tests/unit/Devices.aadl Location: (18,39,18,73) Compilation Phase: Ambiguity filter
Unsolved Ambiguity 2)
Exception in thread "main" java.lang.AssertionError: The greatest lower bound (GLB) of sorts [SubCmpAssocDef, ModalPpeValue]doesn't exist!
in ModesAndModeTransitions.aadl.error