Re: help with EBNF grammar

"William S. Lear" <rael@zopyra.com>
31 Mar 2001 02:32:47 -0500

          From comp.compilers

Related articles
help with EBNF grammar paul.meaney@qa.comstar.co.uk (Paul Meaney) (2001-03-28)
Re: help with EBNF grammar rael@zopyra.com (William S. Lear) (2001-03-31)
Re: help with EBNF grammar rboland@unb.ca (Ralph Boland) (2001-03-31)
Re: help with EBNF grammar mahesha@india.hp.com (Mahesha N) (2001-03-31)
Re: help with EBNF grammar limpus@immortalnet.com.au (Raymond Limpus) (2001-03-31)
Re: help with EBNF grammar mike@dimmick.demon.co.uk (Mike Dimmick) (2001-03-31)
Re: help with EBNF grammar uabbwat@uab.ericsson.se (Barry Watson) (2001-04-04)
Re: help with EBNF grammar rael@zopyra.com (William S. Lear) (2001-04-04)
| List of all articles for this month |

From: "William S. Lear" <rael@zopyra.com>
Newsgroups: comp.compilers,comp.compilers.tools.javacc
Date: 31 Mar 2001 02:32:47 -0500
Organization: Zopyra
References: 01-03-154
Keywords: parse
Posted-Date: 31 Mar 2001 02:32:47 EST

"Paul Meaney" <paul.meaney@qa.comstar.co.uk> writes:
> .... I have to
> write a parser that will evaluate input expressions to boolean true/
> false. I have never done anything like this before.
>
> In searching the web I have hit on the idea of using the JavaCC
> and defining my own grammar in Extended Backus- Naur Form to turn the
> input expression into a Java statement. However all the online
> documentation for EBNF is for 2nd/ 3rd year computing courses and are
> heavily mathematical in nature. Given my background I find it really
> difficult to understand what is going on.
>
> Does anyone know of any resources on the web/ good books on the
> subject that can teach someone who is not stupid the basics of EBNF,
> parse trees and recursive- descent parsing?


You could post here what you are trying to accomplish and perhaps we
could help. You may not need to know the deep theory of grammar in
order to accomplish your task. It's difficult to tell from your brief
description, but it sounds as if translating your statement into Java
code is a bit of overkill, if indeed all you want is a true/false
evaluation of the expression. With JavaCC, you will end up with a
class (parser) that you can use to parse expresssions and give you
this boolean result directly, rather than evaluating Java code.


Post away, I say, that is what these forums are for.


NB --- I am *not* a parser expert, but would be glad to offer what
help I can.




Bill
--
William S. Lear | Who is there that sees not that this inextricable labyrinth
r a e l @ | of reasons of state was artfully invented, lest the people
z o p y r a . | should understand their own affairs, and, understanding,
c o m | become inclined to conduct them? ---William Godwin, 1793





Post a followup to this message

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