Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!usenet.blueworldhosting.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED!nerds-end From: Jens Kallup Newsgroups: comp.compilers Subject: interpreter: how is it possible to interpret nested IF ELSE ENDIF ???? Date: Wed, 15 May 2013 07:42:19 +0200 Organization: 1&1 Internet AG Lines: 32 Sender: johnl@iecc.com Approved: comp.compilers@iecc.com Message-ID: <13-05-009@comp.compilers> NNTP-Posting-Host: news.iecc.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: leila.iecc.com 1368830758 61761 64.57.183.58 (17 May 2013 22:45:58 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Fri, 17 May 2013 22:45:58 +0000 (UTC) Keywords: interpreter, question Posted-Date: 17 May 2013 18:45:58 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:895 Hello, like the topic says: a give construct should be interpret through a single pass???: IF 2 == 3 print "not print" IF 2 == 3 print "not" ELSE print "wrong1" ENDIF print "3" ELSE print "this" ENDIF Thanks for helping Jens [My usual advice is to translate the source to something easy to interpret like an AST, then run your interpreter on that. Trying to jump around in the source code and remember when to parse what and to avoid side effects when parsing through code you're supposed to skip is miserable. -John]