Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Parse::RecDescent: how does <matchrule:> work?

by sundialsvc4 (Abbot)
on Feb 07, 2013 at 14:28 UTC ( [id://1017668]=note: print w/replies, xml ) Need Help??


in reply to Parse::RecDescent: how does <matchrule:> work?

Question #1 is ... what do you want?   (No, seriously.)   What interpretation of these three strings do you want to be “correct?”   Are they three distinct cases, or examples of the same one?

The interpretation that I guess you probably want is that there are only three tokens of interest:   '{', '}', <ident>.   The grammar, in quasi-BNF syntax, would then become:

<statement> ::= <ident> | '{' <statement>+ '}' ; <ident> ::= /[A-Za-z0-9]/ ;

This would be a simple left-tail recursive case.   But I am sure that my syntax is not actually sufficient for your needs, because if it were, you would scarcely need a parser with which to solve it.

Please provide a full representative example of the type of data you need to parse, and we’ll help you write the proper grammar-mojo.   It does take practice.

Replies are listed 'Best First'.
Re^2: Parse::RecDescent: how does <matchrule:> work?
by 7stud (Deacon) on Feb 08, 2013 at 03:41 UTC

    Please provide a full representative example of the type of data you need to parse, and we’ll help you write the proper grammar-mojo. It does take practice.

    The sample text and my finished grammar are over here.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1017668]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-19 10:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found