in reply to How would you parse this?

What is your question? Write the equivalent Perl classes (e.g. using Moose and provide a script to turn your example into the Perl version?

Replies are listed 'Best First'.
Re^2: How would you parse this?
by LanX (Saint) on Oct 25, 2013 at 16:34 UTC
    > > Purely speculative bullshine, down-voted.

    too bad, you'll be downvoted now for speculating! ;)

    Cheers Rolf

    ( addicted to the Perl Programming Language)

      Just a plain vanilla question... no speculation... Well, two questions. And I do not really know Moose, so if the answer is yes, I will not be able to write such a script.

        > Just a plain vanilla question... no speculation...

        Pardon my sarcasm, I wasn't joking about you. =)

        I couldn't resist commenting on this attitude to throw in a piece of an unknown language, requesting a solution and to threaten speculators with downvotes...

        Cheers Rolf

        ( addicted to the Perl Programming Language)

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re^2: How would you parse this?
by BrowserUk (Patriarch) on Oct 25, 2013 at 20:07 UTC
    What is your question?

    The question is right there in the title. How would you approach the task of parsing this data?

    "use Parse::RecDescent;" is not an answer; because it does not begin to explain how to go about deriving a grammar to encapsulate the source.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      Here is an example of a grammer:http://json.org and here is a straightforward translation into a regex based parser JSON parser as a single Perl Regex. This might be a model for the parser you require. (Straightforward in the sense of a one-to-one translation, not in the sense of simple.)

        It doesn't seem to be a data structure it's code, with [ key : value , ] hashes and { code  } blocks.

        At least I guess so, the example given has at least one syntax error, a comma is missing (between Real: and  String:)

        With the sparse information provided it doesn't make sense to speculate.¹

        IMHO one more case of How (Not) To Ask A Question

        Cheers Rolf

        ( addicted to the Perl Programming Language)

        ¹) oops, sorry just realizing that speculations are verboten... ;-)

        Here is an example of a grammer

        Thanks, but the first problem is deriving the grammar. It doesn't yet exist.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.