Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!lll-lcc!seismo!mcvax!botter!erikb From: erikb@botter.UUCP Newsgroups: comp.os.minix Subject: Re: expr(1) source - bug fix Message-ID: <1139@botter.cs.vu.nl> Date: Mon, 13-Apr-87 02:59:08 EST Article-I.D.: botter.1139 Posted: Mon Apr 13 02:59:08 1987 Date-Received: Wed, 15-Apr-87 00:40:46 EST Sender: remote@cs.vu.nl Reply-To: erikb@cs.vu.nl (Erik Baalbergen) Distribution: world Organization: V.U. Informatica, Amsterdam Lines: 44 Keywords: expr bugs The following is a fix in reply to the bug (expr '(' 1 ')' + 1) as reported by Barry Brachman. The '<' lines refer to the bug version, the '>' to the fixed version. Erik Baalbergen -- cut here -- 4c4,5 < expr ::= expr operator expr | "(" expr ")" ; --- > expr ::= primary | primary operator expr ; > primary ::= '(' expr ')' | signed-integer ; 49,50c50,51 < {"(", LPAREN, 0}, < {")", RPAREN, 0}, --- > {"(", LPAREN, -1}, > {")", RPAREN, -1}, 128,131c129,135 < res = expr(lex(*++ip), MAXPRIO); < if (lex(*++ip) != RPAREN) < syntax(); < return res; --- > if (prio == 0) { > res = expr(lex(*++ip), MAXPRIO); > if (lex(*++ip) != RPAREN) > syntax(); > } > else > res = expr(n, prio - 1); 133c137,143 < if (n != OPERAND) --- > else > if (n == OPERAND) { > if (prio == 0) > return num(*ip); > res = expr(n, prio - 1); > } > else 135,137d144 < if (prio == 0) < return num(*ip); < res = expr(n, prio - 1);