Wednesday 8 June 2016

Flex and Bison for SIM

SIM stands for Structure Information Modeling. SIM parses a file and converts it into tabular information that can prove to be instrumental in analysis. Now the question arises: what type of file does SIM parses? To answer this question I must introduce a software first:

STAAD PRO, is a software used by civil engineers to design buildings and structures in 3D. All one needs to know about this software is that it always has a file associated with each design that contains all the commands the designer may/ may not enter in order to design stuff in the structure. Now this file (having a .std extension) contains everything there is to know about the design. And hence we parse it to extract all this information and store it in a much more comprehensible format i.e. a database. And this of course gives us the freedom of collecting information regarding various designs in one place instead of juggling that many files. 

So far so good. The main focus of this post is the parsing bit of the file. The commands used in a .std file come from a wide range of fixed commands described in the technical manual for STAAD PRO. The amount of syntactic flexibility and sheer vocabulary, proportionate this to language in it's own right. This means that in essence SIM needs to handle this language not for the purposes of implementing it, but for the purpose of transforming it into a much more abstract form. And of course since the amount of parsing is going to get more and more complex, ad hoc methods of parsing will soon run out of convenience and efficiency. 


Flex and Bison seem to be perfect for such a job. Other parts of SIM shall remain the same (and evolve thus) but parsing of the file needs to done using flex and bison. I need to understand the grammar of the STAAD PRO command languages in order to code that using bison. This is the difficult part. Forming regular expression shall be easy. At least I hope that is the case because then I would have to work even harder. And who likes to work hard? I don't. 

No comments:

Post a Comment