EBNF Grammar help - part II

"Paul Meaney" <paul.meaney@qa.com_NOSPAM.star.co.uk>
4 Apr 2001 00:23:40 -0400

          From comp.compilers

Related articles
EBNF Grammar help - part II paul.meaney@qa.com_NOSPAM.star.co.uk (Paul Meaney) (2001-04-04)
Re: EBNF Grammar help - part II joachim_d@gmx.de (Joachim Durchholz) (2001-04-10)
Re: EBNF Grammar help - part II cfc@world.std.com (Chris F Clark) (2001-04-10)
| List of all articles for this month |

From: "Paul Meaney" <paul.meaney@qa.com_NOSPAM.star.co.uk>
Newsgroups: comp.compilers,comp.compilers.tools.javacc
Date: 4 Apr 2001 00:23:40 -0400
Organization: Compilers Central
Keywords: parse
Posted-Date: 04 Apr 2001 00:23:40 EDT


        Many thanks to all the people who replied to my original post requesting
help with EBNF Grammar. The general consensus appears to be that I could
probably accomplish my objectives by developing a top- down recursive-
descent parsing algorithm. I have read about these and sort of comprehend
their function and objectives however I am still unclear as to how to go
about developing such a routine in Java.

        If I can explain my objective:

        in order to advance throughout our software a user must have
achieved a set of objectives. these are held in a text file
format. The objectives read like "you must have done A and (B or C) or
(D and E and F) and one out of (G, H, I)". The operators are well
defined, encompass basic logic (and, or, not) and elementary
sets. There is also a well documented set of operator precedence
rules. Operators take the standard form: '|', '+', '!', '{}'.

        The objective is to read in this expression from a file and parse
it so that I can arrive at a set of Java expressions that I can
serially step through and evaluate. If a user fails to achieve an
objective I can return false and the routine will exit. My stumbling
block is how to parse the string expression to derive a set of
concrete java expressions which I can the evaluate. For instance the
''one out of three' expression would be treated as an array that I can
step through and evaluate, but I have no Idea how to generate this.

        The reason I thought of using JavaCC is that it would have
generated JavaCode from the input expression which I could have then
evaluated. From a description of my problem, is this still viable?

        Any advice or suggestions would be most grateful.


Post a followup to this message

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