School of Computer Science PDE 2005expressik1 expressik: an open source EXPRESS parser and...
-
Upload
evelyn-mccormick -
Category
Documents
-
view
214 -
download
2
Transcript of School of Computer Science PDE 2005expressik1 expressik: an open source EXPRESS parser and...
PDE 2005 expressik 1
School ofComputer Science
expressik: an open source EXPRESS parser and application development kit
Andy Carpenter
PDE 2005 expressik 2
School ofComputer Science
EXPRESS Interface Kit (expressik)
• Funded by ESTEC TEC-MCV, ESA• Focus unlicensed software for thermal analysis data• As general as possible within timescales of project
– test cases include AP203, AP209, AP214, AP233• Separate model analysis from SDAI generation• Maximise application independent analysis• Language bindings:
– C++ (early bound), C (p24), – Python (pyEXPRESS), Fortran
• Preserve existing TASVerter and its API• Part 21 (2002) import and export (class 1 and 2)
PDE 2005 expressik 3
School ofComputer Science
Model Analysis
• Process 10303-11 (1994) and some 10303-11 (2004)• Single or multi-schema• Always has a viewpoint schema• Almost no semantic checking• Reference resolution (can be multiple resolutions)• Importation defined by model followed, includes
– identifying dependent and independent objects• Data type(s) of objects determined• Possible CEDTs can be determined (sometimes)• API in Java is read-only• Source location transferred to API
PDE 2005 expressik 4
School ofComputer Science
Parser Architecture
Syntax Parser
(Antlr based)
Pass 1
AST
API
Pass 2
API Populator
Pass 3Pass n
EXPRESS Model
APPLICATION
PDE 2005 expressik 5
School ofComputer Science
Parser Passes 1
1. Make the scope tables
2. Resolve schema references
(in USE and REFERENCE FROM clauses)
3. Import the objects specified by the USE and REFERENCE clauses
4. Import any enumeration ids that are visible
5. Resolve subtype/supertype references
6. Inherit attributes from supertypes down into subtypes (unless there are id clashes)
PDE 2005 expressik 6
School ofComputer Science
Parser Passes 2
7 Resolve all references apart from where they are part of an attribute qualification; i.e. work out the starting bits of expressions, etc
8 Then using the viewpoint schema do Annex C– Apply the Section 11 rules for importation– Prune the supertype graph (i.e. alter supertype
expressions) to remove non-imported entities– Apply Annex B
9 Load the API
1 Depth first walk of AST
2 Fixup qualifications within expressions, etc
PDE 2005 expressik 7
School ofComputer Science
API – Model Elementpublic final class Model extends ExpressObject {
public Schema[] getSchemas();
public Schema getViewpointSchema();
public ModelSpecificConstant[] getConstants();
public DefinedDatatype[] getDefinedDatatypes();
public EntityDatatype[] getEntityDatatypes();
public ModelSpecificFunction[] getFunctions();
public ModelSpecificProcedure[] getProcedures();
public Rule[] getRules();
public …[] getComplexEntityDatatypes();
public void visitorAccept(…);
} // Model
PDE 2005 expressik 8
School ofComputer Science
API – Entity Datatype Elementpublic final class EntityDatatype extends … {
public Identifier getModelIdentifier();
public Identifier getOriginalIdentifier();
public Identification[] getIdentifications();
public EntityDatatype[] getImmediateSupertypes()
public DomainRule[] getDomainRules();
public UniqueRule[] getUniqueRules();
public void visitorAccept(…);
…
PDE 2005 expressik 9
School ofComputer Science
API – Entity Datatype Element (Attributes)…
public Attribute[] getAllAttributes();
public …[] getExplicitAttributes();
public …[] getDerivedAttributes();
public …[] getInverseAttributes();
public …[] getAllAttributeRedeclarations();
public …[]
getAttributeExplicitRedeclarations()
public …[] getAttributeDerivedRedeclarations();
public …[]
getAttributeInverseRedeclarations()
} // EntityDatatype
PDE 2005 expressik 10
School ofComputer Science
API – Complex Entity Datatypepublic final class ComplexEntityDatatype extends
ComplexDatatype {
public …[] getComponentEntityDatatypes()
public EntityDatatype getLeaf ()
public Attribute[] getAllAttributes()
public …[] getAllExplicitAttributes()
public AttributeRedeclaration[]
getEffectiveRedeclarations (… attribute)
public boolean isDependent()
public boolean isNonSchema()
public void visitorAccept(…);
} // ComplexEntityDatatype
PDE 2005 expressik 11
School ofComputer Science
C++ (Early Bound) SDAI Binding
• Generated in, almost, single pass over API• Uses templates to implement early bound aggregates• Template functions deal with GENERIC and
AGGREGATE parameters• Implements EXPRESS assignment/copy semantics
– copy unless entity; need entity reference concept• Substantial use of overloaded operators
– C++ parser determines correct implementation• User deals with EDTs not CEDTs• Not early bound when EXPRESS is not• Implemented in Java
PDE 2005 expressik 12
School ofComputer Science
C++ Binding and Entity Instances
• C++ ‘believes’ that can make copies of instances• Introduced entity reference object
– one for each EDT• Need to preserve inheritance in reference and
referenced objects
A (ABS)
B C
1
A (ref)
B (ref)
C (ref)
AB
B
C
A
AC
PDE 2005 expressik 13
School ofComputer Science
EXPRESS is not Always Early Bound…
LOCAL
a1, a2 : A;
b1, b2 : B;
END_LOCAL;
…
a1 := A(…) || B(…);
a2 := A(…) || C(…);
b1 := a1;
b2 := a2;
…
A (ABS)
B C
1
PDE 2005 expressik 14
School ofComputer Science
Current State
• Multiple internal project releases done– parser and C++ binding generator– parser needs to support reading CEDTs used– C++: soon all functional code and verification
• Python binding soon• License allowing public access on-going
– based on NASA Open Source Agreement• Documentation of C++ binding out-of-date• All to be sorted in the short-term