Re: Interactive statement execution

skrenta@casbah.acns.nwu.edu (Rich Skrenta)
Tue, 4 Aug 1992 03:11:30 GMT

          From comp.compilers

Related articles
Interactive stamtment execution elliot@wellspring.com (Elliot H. Mednick) (1992-07-29)
Re: Interactive statement execution skrenta@casbah.acns.nwu.edu (1992-08-04)
| List of all articles for this month |
Newsgroups: comp.compilers
From: skrenta@casbah.acns.nwu.edu (Rich Skrenta)
Organization: Northwestern University, Evanston, Illinois
Date: Tue, 4 Aug 1992 03:11:30 GMT
Keywords: yacc, interpreter
References: 92-07-088

elliot@wellspring.com (Elliot H. Mednick) writes:
> In "interactive mode", entering declarations would be
> illegal; only the statements would be allowed.


Assuming that you don't allow interactive mode to declare variables
because you've already chosen a scope, it sounds like you only
want to allow the user to type executable statements. You could
limit interactive mode to the tree rooted at statement_list.


One trick to do this might be to have the lexer cough up a special
token before interactive input:


S
  : program
  | statement
  | INTERACTIVE statement_list
  ;


program
  : header declaration statment_list
  ;
...


--
Rich Skrenta
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.