Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!fas-news.harvard.edu!newspump.wustl.edu!news.ecn.bgu.edu!vixen.cso.uiuc.edu!howland.reston.ans.net!Germany.EU.net!news.dfn.de!gina.zfn.uni-bremen.de!marvin.pc-labor.uni-bremen.de!news.uni-stuttgart.de!news.belwue.de!news.belwue.de!news.informatik.uni-stuttgart.de!ortlofrd
From: ortlofrd@track.informatik.uni-stuttgart.de (Roland Ortloff)
Subject: Need Help about Parsing :)
Message-ID: <D8qBK4.Mov@news.informatik.uni-stuttgart.de>
Sender: ortlofrd@track (Roland Ortloff)
Organization: Informatik, Uni Stuttgart, Germany
Date: Wed, 17 May 1995 15:40:49 GMT
Lines: 48

Hi folks,

we're looking for an example to parse an expression. 

An example sentence would be: a > 5 AND b < 3 OR c BETWEEN a AND b

    is equivalent to: ((a > 5) AND (b < 3)) OR (c BETWEEN a AND b)

Hint: c BETWEEN a AND b means: a <= c AND c <= b


The grammar we have to use will be more complicated,
so we're looking for an easy-to-expand solution.

One idea was, that we convert this sentence from infix to praefix-notation

==> OR( (c BETWEEN a AND b), 
        AND ((> a b), 
             (< b 3)
            )
      )

Is there sth. like a build-in command that would help us doing this,
or should this be done with the commands "op :- ...",
or with a DCG like "left --> right"?

Unfortunately we don't have an example that would help us to understand
this DCG-stuff.


Is there anyone who has an example-program that would except
a single sentence with a DCG?


Any help greatly appreciated.


Ciao Roland :)

-- 

       _/_/_/_/_/_/_/   \ ortlofrd@trick.informatik.uni-stuttgart.de /
      _/    _/    _/     \   zcrk1121@rpool1.rus.uni-stuttgart.de   /
     _/    _/_/_/_/       \   ortlofrd@studbox.uni-stuttgart.de    /
    _/    _/  _/           \      oslo@al.lms.tynet.sub.org       /
   _/_/_/_/    _/           \------------------------------------/

  ** If you're feeling good, don't worry, you'll get over it. **
