Anyone help a newbie at parsing/syntax error reporting?

"paul.dunn4" <paul.dunn4@ntlworld.com>
1 Feb 2001 17:49:47 -0500

          From comp.compilers

Related articles
Anyone help a newbie at parsing/syntax error reporting? paul.dunn4@ntlworld.com (paul.dunn4) (2001-02-01)
| List of all articles for this month |

From: "paul.dunn4" <paul.dunn4@ntlworld.com>
Newsgroups: comp.compilers
Date: 1 Feb 2001 17:49:47 -0500
Organization: ntlworld News Service
Keywords: parse, question
Posted-Date: 01 Feb 2001 17:49:47 EST

Hi all, having "lurked" for a while in this group, I thought I might
post a message. I'm posting normally through MS Outlook Express, so if
that's the wrong thing to do, then I apologise.


Anyway, I'm currently writing a Sinclair BASIC interpreter. I've
written interpreters before, but as I was the only person expected to
code in them, the error and syntax checking was a little down the list
of priorities. Now however, I am trying to parse a line of basic
code. I have tried a few methods - reducing using rules (# + # becomes
#) but the best one by far that I have tried is BNF - using a parse
tree. It's only simple, but I've come up against a small problem. I
can tell when and why the parser drops out with a syntax error, but I
want to be able to report more than "Expected X, but found Y" errors,
such as "The keyword TO cannot be used to subscript a numeric
variable"


However, due to the recursive nature of my BNF checker, I only find
which rule failed, not why. Does anybody have experience of this sort
of thing, and can point me in the right direction?


Thanks
        Paul.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.