Parser for process algebra

I would like to create a parser for process algebra. The process algorithm has this syntax:

System=P:[s,l]|(P:[s,l']|P:[s,l])\{a,b} 

How can I check if a line instruction should follow this syntax ??? Some pseudo code will be very useful.

+4
source share
1 answer

You cannot use regular expressions to perform this task in the general case, because you have nested constructions (brackets). You need at least the power of what is called a push-down automaton .

To solve this problem, you will need a so-called parser that recognizes the grammar of the process language.

Do you have a grammar specification for the language? You can express the grammar with a tool such as ANTLR .

Explore Google Search Results: Java Parser Generators

+2
source

All Articles