Research Article
An Algorithm for Generating Boolean Expressions in VHDL Based on Ladder Diagrams
Algorithm 5
The interpretation algorithm.
| Function-5: TranslateAndOrTreeIntoBooleanExpression | | Input: the root node of the And-Or tree named “root” | | Output: the Boolean expression of the And-Or Tree | | expression ← new string() | | if (root.children.count == 0) | | Return expression ← root.toString() | | end // if | | if (the type of root is AND-Node) | | for childNode: root.children | | subExpression ← TranslateAndOrTreeIntoBooleanExpression(childNode) | | Expression ← expression + “AND” + subExpression | | end for | | else | | for childNode: root.children | | subExpression ← TranslateAndOrTreeIntoBooleanExpression(childNode) | | Expression ← expression + “OR” + subExpression | | end // for | | end // if | | Expression ← “(“+ expression +”)” | | return expression |
|