convert an id to sbml valid format. First add type of id “R” for reaction
“M” for compound at the start and the compart at the end.
_type+”_”+uncoded+”_”+compart
then replace not allowed char by integer ordinal
:param uncoded: the original id to code
:type uncoded: str
:param _type: the type of the id (ex: ‘R’ or ‘M’)
:type _type: str
:param compart: the compartment of the id (ex: ‘c’ or ‘e’)
:type compart: str

Use convert_from_coded function to convert a element_id (reaction or species)
_type use define if element is a ‘reaction’ or un ‘species’.
Try different decoding combination based on old and new sbml id encoding.

Use a finite state machine (see generate_fsm() function) to parse the input,

produce a syntactic tree from the lexical table,
that is finally used for find the expected ouput.

The API consist only in the compile_output(1) function.
All other functions are used internally, or not used at all

but conserved for science. (only postfix(1) function is in this last case)

The compile_output(1) function is high-level and simple. You may want to

begin there if you want to read these code.

PEP8 is completely busted at some point, but its mainly because of

readability of big lines.

Principles:
- lexical analysis of the input string, given the lexems (id, operators, parenthesis)
- generate the polish notation of the lexical table
- syntactic tree construction
- walks in the syntactic tree to determine the possible paths to leafs

Idea is, mainly, that a syntree is simple to store (dict {node:successors}),

and represent well the input data.
The walks is performed by the eval_tree function,
and simply consist of a recursive DFS with generation of the
whole path since the root each time a leaf is hit.
Behavior of AND and OR operators are hardcoded.

Read a token.
If the token is a number, then add it to the output queue.

If the token is an operator, o1, then:

while there is an operator token, o2, at the top of the operator stack, and either

o1 is left-associative and its precedence is less than or equal to that of o2, or
o1 is right associative, and has precedence less than that of o2,

then pop o2 off the operator stack, onto the output queue;

push o1 onto the operator stack.

If the token is a left parenthesis (i.e. “(“), then push it onto the stack.
If the token is a right parenthesis (i.e. “)”):

Until the token at the top of the stack is a left parenthesis, pop operators off the stack onto the output queue.
Pop the left parenthesis from the stack, but not onto the output queue.
If the token at the top of the stack is a function token, pop it onto the output queue.
If the stack runs out without finding a left parenthesis, then there are mismatched parentheses.

When there are no more tokens to read:

While there are still operator tokens in the stack:

If the operator token on the top of the stack is a parenthesis, then there are mismatched parentheses.
Pop the operator onto the output queue.