2

I need to write a custom parser for EXPRESS - which is mentioned to be a data modeling language that is used to define and pass construction information around for CAD software. Here are couple resources:

https://en.wikipedia.org/wiki/EXPRESS_(data_modeling_language) https://www.loc.gov/preservation/digital/formats/fdd/fdd000449.shtml

Well, I need to come up with a custom parser for this "data modeling language" . However, I have no idea what specifics I need to pay attention to before I can start implementing a decent parser. In what ways should I analyze this text-based format before deciding how to parse it and represent it in a meaningful way?

What do I specifically need to know about this "data modeling language" and its syntax so that I can come up with a reasonable parser?

nmd_07
  • 666
  • 1
  • 9
  • 25
  • You need to know its syntax. :) That's probably formally described in one of the standards documents. If you're lucky, you will have the appropriate one handy courtesy of your employer, since otherwise you'll have to beg, borrow or buy one from the ISO. – rici Jul 06 '18 at 20:13
  • @rici The second link I shared mentions that "EXPRESS is defined in a derivative of Wirth Syntax Notation (WSN)." – nmd_07 Jul 06 '18 at 21:03
  • Yes, and the documents for EXPRESS are written in English. That's enough to get started, right? :) The second link you shared also mentions that the formal specification is found in [ISO standard 10303-11:2014](https://www.iso.org/standard/38047.html) which you can buy from the ISO for CHF 198. (It may be cheaper if you go to your national standards body. Or maybe not.) – rici Jul 06 '18 at 21:24
  • 2
    Assuming you're looking to parse IFC STEP files (which are defined using the EXPRESS syntax), why don't you look at some of the toolkits and libraries that already handle parsing and processing of the data files. E.g. Here are three for starters http://docs.xbim.net/ http://ifcopenshell.org/ or https://github.com/hypar-io/IFC-gen – Andy Ward Jul 11 '18 at 11:06
  • 1
    Disclaimer: I'm involved with XBim - but my observation is there's a lot more to exchanging construction information than parsing EXPRESS files. I'd be looking to get a jump-start by building off something other organisations have built and proven rather than start from scratch... – Andy Ward Jul 11 '18 at 11:13

3 Answers3

2

There are descriptions of the EXPRESS language in Backus-Naur-Form on github. There are tools that take a description in BNF and generate a parser from it (for example bison or boost::spirit).

These will give you a working text parser for the language. The next step is to give the parsed text a meaning. EXPRESS usually describes a class hierarchy and certain constraints, so you will need to model that with the tokens you get from the parser.

You might want to take a look at existing implementations, for example stepcode. They have an EXPRESS parser which takes the EXPRESS schema and generates a STEP parser which can load files described by the EXPRESS schema.

You should know that EXPRESS and STEP are very powerful and extensive tools, so you should consider using/modifying existing implementations instead of rolling your own.

Loebl
  • 1,381
  • 11
  • 21
0

Here you can find a parser for C++ implemented using Flex and Bison: oipExpress

hlg
  • 1,321
  • 13
  • 29
Vertexwahn
  • 7,709
  • 6
  • 64
  • 90
  • iopExpress parser has some flaws. It does not function fully. – nmd_07 Sep 22 '18 at 23:46
  • When either IFC2x3_TC1.exp or IFC4.exp is provided to the parser, the parser gives an error. However, the later versions seem to work fine although I am not really sure how correct the representation is within the Schema and Entity classes. – nmd_07 Sep 22 '18 at 23:53
0

There is a parser based on in the EXPRESS2EMF project. It is not yet complete though. Currently it is still skipping constraints (aka where rules) and some EXPRESS language constructs that are not used in IFC specifications.

hlg
  • 1,321
  • 13
  • 29