From: x91nikorawal@wmich.edu (HACKER)
Subject: <<HELP with recursive descent parser>>
Date: 12 Nov 94 13:27:26 EDT
Date: 1994-11-12T13:27:26-04:00 [thread overview]
Message-ID: <1994Nov12.132726.23824@wmichgw> (raw)
Hi,
The Recursive Descent procedure I have, takes care of all cases
except one, the number + (expression) case. Ex 2 + (3 * 4).
The grammar I am following is...
E ==> E + T
E ==> T
T ==> T * F
T ==> F
F ==> (E)
F ==> NUMBER
i.e Only taking care of addition and multiplication
Here are the pseudo-codes for my procedures...
Procedure F
Begin
Symbol := lex();
If symbol == number then return TRUE
If symbol == Lpar then do begin /* lpar is Left
paranthesis */
If E() == TRUE then do begin
symbol := lex();
If symbol == Rpar then return TRUE
end;
else return FALSE
Procedure T
Begin
If F() == TRUE then return TRUE
else begin
If T()==TRUE the do begin
Symbol := lex();
If symbol == '*' then
If F() == TRUE return TRUE
else return FALSE
Procedure E
Begin
If T() == TRUE then return TRUE
else begin
If E()== TRUE then
symbol = lex();
If symbol == '+' then
If T() == TRUE then return TRUE
else return FALSE;
Any help/suggestion will be appreciated
Thanks
Percy
next reply other threads:[~1994-11-12 17:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-11-12 17:27 HACKER [this message]
1994-11-13 0:43 ` <<HELP with recursive descent parser>> Joe Halpin
1994-11-13 2:02 ` S M Ryan
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox