Title: Developments with pyExpress an open source Python binding
1Developments with pyExpressan open source Python
binding
- Hans Peter de Koning (ESA/ESTEC D/TOS-MCV, The
Netherlands) - Hans-Peter.de.Koning_at_esa.int
- 6th NASA-ESA Workshop on Product Data Exchange
- April 20-23, 2004, EADS/Astrium, Friedrichshafen,
Germany
2Objectives pyExpress
- Lower the threshold for implementation of STEP
standards as much as possible - Ensure full portability across all computer
platforms / compiler combinations used for
(space) analysis tools - Provide an OSS environment for STEP based PDE
converters which is comparable in power and
effectiveness with XML OSS environments - Ensure long term availability of STEP based data
exchange solutions to ESA in the long term,
without any dependency on third party STEP
toolkit vendors - As much automated code generation as possible
3Why Python?
- Free of charge, very powerful open source
environment - Highly portable across Windows, Linux, all
UNIXes, MacOS - Hugh set of well-tested library modules
- Numeric computation, XML, HTTP, regular
expressions, etc. - Dynamic memory management / automatic garbage
collection - Elegant object oriented programming model
- Weakly typed but with powerful runtime type
checking - Very powerful text processing and reflection
capabilities - Easy mapping to EXPRESS almost a natural fit
- Easy to implement interfaces with C/C libraries
(using SWIG) - In our experience much higher productivity
environment than C or Java - See http//www.python.org
4pyExpress development history
- 2002, June Decided to prototype an EXPRESS
compiler and library code generator in Python for
STEP-NRF and STEP-TAS - 2002, September Completed feasibility study
(250h) successfully - Basic scanner / parser / Python library generator
working - Using SPARK lexer/parser package (purely Python)
- 2002, October Decided to go ahead with pyExpress
code generators for industrial use in upgraded
STEP-TAS libraries and converters - Simulog Graitec (France) ANSI C library
generator, C/C converters - ESA/ESTEC Python class library generator,
TASverter tool - 2003, March First releases of pyExpress,
TASverter, C libraries - 2004, February Fifth release of TASverter (now
used in production environment) - 2004, March Start upgrade pyExpress and merge
with Jex (Univ. of Manchester)
5Current capabilities
- Handles long form EXPRESS edition 1 SCHEMA
- CONSTANTs, TYPEs, ENTITYs, FUNCTIONs
- most WHERE rules
- explicit, redeclared and DERIVEd attributes
- Has built-in Part 21 reader/writer
- Not yet implemented
- USE FROM and REFERENCE FROM
- INVERSE attributes
- UNIQUE rules and global RULEs
- complex instances
- GENERIC type and ARRAY with non-default index
bounds - QUERY statement and some other built-in functions
6Design approach
- Highly modular
- Support ISO 10303-111994 (i.e. EXPRESS version
1) - Support ISO 10303-211994 (single schema / data
section) - Generate early binding class libraries
- Start with Python and C
- Stay as close as possible to EXPRESS schema
structure, but adapt to target language
conventions - Make extensive use of Python (class / type)
reflection capabilities - Defensive programming and runtime type checking
throughout - Python is a weakly typed language
- Tool is too large to rely on programmer
discipline use positive asserts
7pyExpress architecture
HTML API manual for Python class library A
SPARK
pyExpress utils
EXPRESS schema A
EXPRESS MetaModel Handler
uses
Scanner / Tokenizer
Early binding Python class library for schema A
Python Code Generator
Parser
tokenlist
Early binding C class library for schema A
C Code Generator
Semantic Analyzer
abstract syntax tree
pyExpress
8Outline of converter based on pyExpress
input
contains in-memory dataset(s) conforming to
Schema A
Converter X-A-Y
File or in-memory data for Tool X
output or input
Support library for Schema A macro
convenience functions
Part 21 writer
Tool X to Schema A reader
ISO 10303-21 file for dataset conforming
to Schema A
Generic STEP repository handler
Python or C API for Schema A
output
Schema A to Tool Y writer
Generated class library for Schema A
File or in-memory data for Tool Y
To be produced by converter developer
Part 21 reader
Schema A Library provided by pyExpress
9pyExpress mapping examples
10Short DEMO with easytan SCHEMA
11Future of pyExpress
- Publish as open source, once formal ESA open
source license is available - Expected later in 2004
- Upgrade with support for missing EXPRESS Edition
1 functionality - Upgrade API and dataset handling to conform to
SDAI (ISO 10303-22) - Develop draft Python SDAI binding (if time
permits) - Complete generation of API (class library) plus
Programmers Manual - from XML version of a STEP application protocol
or resource - Merge best of pyExpress and Jex (nicknamed pyJex)
- ESA contract with Manchester Informatics Ltd.
(UK) and University of Manchesters Dept. of
Computer Science (Prof. Hilary Kahn) started
March 2004 - EXPRESS schema processing using Java generates
Python, Java, C/C APIs - Planned to be published as open source 2005-Q2
- Use on ESATAP (ESA Thermal Analysis
Post-processor) for ESATAN results - Contract started in Jan 2004 with Silogic (F),
Alcatel Space (F), Dorea (F)
12Acknowledgements
- My co-workers at ESA/ESTEC Simon Appel, David
Alsina - Contractor Incka (France) Olivier Pailles,
Arnaud Klinger - Subcontractor GRAITEC (France) Eric Lebègue and
co-workers - The developers of exp-engine.sourceforge.net
(expresso) Peter Denno, Craig Lanning, Steve
Waterburyand osexpress.sourceforge.net Josh
Lubell, Michael Keenan, Stephane Lardetfor
valuable ideas and examples on how to parse
EXPRESS schemas - The developer of the Python SPARK module John
Aycock (http//pages.cpsc.ucalgary.ca/aycock/spar
k)