Yes well you see the problem is that I was feeling slightly guilty. When I read the article originally, i had no idea what Parrot was, so the term "Parrot Basic" suggested a version of basic called Parrot, not, as it turned out, a version of basic that was supposed to run on an alpha-version virtual machine.

Thus, you can understand that in my view, the fact that the basic interpreter (which I figured to be in perl) could not handle nested ELSE suggested that its internals were designed incorrectly (since perl is more than capable of recursion with little effort), and therefore it was in the best interests of the questioning monk to re-write his code in a manner more suited to the problem. I have no problem being blunt about this if necessary.

The issue of course, being that it was not just another basic interpreter, nor was it written in perl. Instead it was written by hand in a register/op-code language that wasn't close to finished. While I looked into it myself and determined that a recursive decent parser is practical on the VM as it stands, it is by no means as trivial as the perl variant.

Thus, by way of apology, I wrote code that would parse the Basic language the proper way and then do the necessary transformations to output a simplified Basic that would be easier to write Parrot code for until such time as it becomes easy to write a grammar within Parrot.


In reply to Re: Re: Parser by Anonymous Monk
in thread Clunky parsing problem, looking for simple solution by clintp

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.