Path: utzoo!mnetor!uunet!oddjob!uwvax!dogie!uwmcsd1!bbn!mit-eddie!bloom-beacon!gatech!uflorida!codas!burl!clyde!watmath!watdragon!djsalomon From: djsalomon@watdragon.waterloo.edu (Daniel J. Salomon) Newsgroups: comp.lang.pascal Subject: How to make Berkeley Pascal explode. Message-ID: <5530@watdragon.waterloo.edu> Date: 4 Mar 88 21:44:31 GMT Distribution: comp Organization: U of Waterloo, Ontario Lines: 17 Keywords: nested expressions While writing test programs for a compiler course, I came across this Pascal program that sends Berkeley Pascal into a deep recursive sleep. Running the version of Berkeley Pascal that came with 4.3 BSD on a Microvax II, it took 420 CPU seconds to compile this program. Adding one more level of parentheses doubles the compile time. Here is the program: -------------------------------------------------------------------- program nest (output); var i, j, k : integer; begin j:=5; i:=-5; k:=2; k := i+(j+(k+(i+(j+(k+(i+(j+(k+(i+(j+(k+(i+(j+(k+(i+(j+(k+i ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ); writeln (i, k); end.