#header-inner {background-position: right !important; width: 100% !important;}


Simple Context Free Grammar Parser

Finite State Automaton can parse words into Tokens, using Regular Expression mechanisms. Then it can parse Tokens into productions (treating each token as letter in a word).

Complex instructions (such as brackets or expressions) can also be parsed this way... just find them using regular expressions, then strip them from token chain and continue processing.

Assignment operations can be done by finding operator and operands, then passing them for further processing.

and so on..


Create instruction graph (graphical representation of grammar), then join them into one larger part. You can use flow net to process them concurrently, thus quicker.

This allows to build data structure (for example Abstract Syntax Tree), which can be used to generate output (for example code in target language).

No comments:

Post a Comment