in reply to Re: How would you parse this?
in thread How would you parse this?

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.

Replies are listed 'Best First'.
Re^3: How would you parse this?
by hdb (Monsignor) on Oct 25, 2013 at 21:36 UTC

    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... ;-)

        the example given has at least one syntax error, a comma is missing

        Thanks++ Corrected.

        With the sparse information provided ...

        So then the question is: what more information is required?

        What I've posted is pretty much all I have. I'll have to invent whatever further information is required, but I'll need to know what that required information is before I can do so.

        it doesn't make sense to speculate.

        Thanks for now endorsing my attempt to discourage speculation.


        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

      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.