Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Ansi -iso > READLN not read...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 148 of 211
Post > Topic >>

READLN not reading

by "Profetas" <xuxu_18@[EMAIL PROTECTED] > Mar 30, 2005 at 10:21 AM

I have a simple menu program that loops and ask the user to type a command,

but after the first command is typed the readln
doesn't read it properly

That doesn't affect much, but it is driving me mad.

has anybode had the same problem?

I am using freepascal BTW.

Thanks (the code is below)



PROGRAM LexDemo;

USES Scanner,Parser;



{VAR}

{ PRE   TRUE }
{ POST  Menu printed out }
PROCEDURE Menu();

BEGIN
  WRITELN('  Logical calculator      by Lucas S Silvs ');
  WRITELN('+------------------------------------------+');
  WRITELN('+           Main Menu                      +');
  WRITELN('+------------------------------------------+');
  WRITELN('| D -=> Display menu                       |');
  WRITELN('| L -=> Lex keyboard input                 |');
  WRITELN('| P -=> Parser the tokens into parse tree  |');
  WRITELN('| E -=> Ealuate the parser tree            |');
  WRITELN('| B -=> Bind an identifier to a value      |');
  WRITELN('| S -=> Show the values of all identifiers |');
  WRITELN('| Q -=> Quit                               |');
  WRITELN('| Print (m)enu                             |');
  WRITELN('| (l)ex token from standard input          |');
  WRITELN('| lex token(s) from standard input         |');
  WRITELN('| (r)ead string                            |');
  WRITELN('| lex tokens from s(t)ring                 |');
  WRITELN('+------------------------------------------+');
END {Menu};

PROCEDURE Main_Loop();
VAR
        Option : CHAR;

BEGIN
        Option := 'd';
   WHILE Option <> 'q' DO
       BEGIN
            CASE Option OF
               'L' : yylex();
               'P' : yyparser(Tokens);
               'l' : Menu();
               's' : Menu();
               'r' : Menu();
               'd' : Menu();
              ELSE
                  Menu();
              END;

       WRITE('Type your command: ==> ');
      READLN(Option);
 END
END {Main_Loop};



BEGIN
   Main_Loop();
END. {LexDemo}




 5 Posts in Topic:
READLN not reading
"Profetas" <  2005-03-30 10:21:17 
Re: READLN not reading
Hanford Carr <"hw  2005-03-30 10:53:42 
Re: READLN not reading
CBFalconer <cbfalconer  2005-03-30 16:51:59 
Re: READLN not reading
Il Razziatore <ilrazzi  2005-03-31 01:50:28 
Re: READLN not reading
CBFalconer <cbfalconer  2005-03-31 01:50:29 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun May 11 19:39:37 CDT 2008.