140 likes | 247 Views
expressik: an open source EXPRESS parser and application development kit. Andy Carpenter Andy.Carpenter@manchester.ac.uk. 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
E N D
expressik: an open source EXPRESS parser and application development kit Andy Carpenter Andy.Carpenter@manchester.ac.uk expressik
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) expressik
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 expressik
Parser Architecture expressik
Parser Passes 1 • Make the scope tables • Resolve schema references (in USE and REFERENCE FROM clauses) • Import the objects specified by the USE and REFERENCE clauses • Import any enumeration ids that are visible • Resolve subtype/supertype references • Inherit attributes from supertypes down into subtypes (unless there are id clashes) expressik
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 • Load the API • Depth first walk of AST • Fixup qualifications within expressions, etc expressik
API – Model Element public 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 expressik
API – Entity Datatype Element public 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(…); … expressik
API – Entity Datatype Element (Attributes) … public Attribute[] getAllAttributes(); public …[] getExplicitAttributes(); public …[] getDerivedAttributes(); public …[] getInverseAttributes(); public …[] getAllAttributeRedeclarations(); public …[] getAttributeExplicitRedeclarations() public …[] getAttributeDerivedRedeclarations(); public …[] getAttributeInverseRedeclarations() } // EntityDatatype expressik
API – Complex Entity Datatype public 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 expressik
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 expressik
A (ABS) 1 B C 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 (ref) A B (ref) B C (ref) C AB AC expressik
A (ABS) 1 B C 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; … expressik
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 expressik