Maria Lopez
Maria Lopez

Reputation: 61

Parser for a process algebra

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

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

How can i check if a string statement follows this syntax??? Some pseudo-code would be very helpful.

Upvotes: 4

Views: 273

Answers (1)

Greg Mattes
Greg Mattes

Reputation: 33959

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

To solve this problem, you need what is called a "parser" that recognizes the grammar of the process language.

Do you have a grammar specification for the language? You could express the grammar with a tool like ANTLR.

Research the results of this Google search: Java Parser Generators

Upvotes: 2

Related Questions