Feb 3, 2005 kl. 4:25 AM skrev Tommy Nordgren:
I have the need to generate and match a large number (Typically 50 - 200) of regular expressions.
Each regular expression should be written in a subset of the perl regular expression syntax, or another suitable syntax. I have not committed to a specific subset yet.
The patterns are not allowed to contain recursive patterns, or interpolated expressions.
The input patterns should be processes into new patterns according to the following rules:
Each pattern will be wrapped in a capturing paranthesis pair. Nested paranthesises should be turned into non capturing paranthesises. The generated patterns should match ONLY at the front of the string matched - ie no matches at embedded newlines.
Thankful for any idea on how to implement this, which is intended for lexical analysis of embedded semantic actions in parser generator and other compiler construction tools.
My regular expressions are at least ALL regular expressions allowed by FLEX.
The strings that I wan't to allow parsing is ALL valid Source code blocks, in languages such
as Java, and C++, with the troublesome $ constructs in bison style specs replaced by named parameters.
For example:
MyNonterminal:result ::= AnotherNonterminal: nt1 operator : op AnotherNonterminal: nt2
SEMANTICACTION <<ENDSEMANTICACTION;
result = new MyTerminalAST(nt1,op,nt2); //Semantic action in c++
ENDSEMANTICACTION
My problem is to generate from specs the lexical analyzer and parser for the semantic
actions, which I wan't to allow writing in any object oriented language.
The language to use will be specified in the input files.
The problem I'm concerned with is allowing the user to specify codegenerators for any
object-oriented language they are interested in.
"Home is not where you are born, but where your heart finds peace" - Tommy Nordgren, "The dying old crone"
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>