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

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

Replies are listed 'Best First'.
Re^4: How would you parse this?
by LanX (Saint) on Oct 25, 2013 at 22:18 UTC
    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.
        > So then the question is: what more information is required?

        A goal or at least a motivation.

        This snippet looks like a meta-definition for a data type "Scalar" and how native types are casted.

        I have no idea what you intend to do with this information in Perl.

        init and this are keywords of an OO language, but with which concrete semantic?

        This seems like an attempt to derive the language of the Bible from two phrases in a antique graffiti in a temple. If this is all you got, better parse it manually with your bio-computer.

        I'm sure someone is playing a joke on you/us ¹, like when you confronted us with this fake math-paper.

        Cheers Rolf

        ( addicted to the Perl Programming Language)

        ¹) maybe a splitted personality?

Re^4: How would you parse this?
by BrowserUk (Patriarch) on Oct 25, 2013 at 22:14 UTC
    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.