Automatic Expression Evaluation (no EOF input from user)

View: New views
1 Messages — Rating Filter:   Alert me  

Automatic Expression Evaluation (no EOF input from user)

by Timothy Washington :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hello all, I've written a shell that implements a grammar (using SableCC3). Now, in the shell, a user who has written an expression has to enter an EOF character for the Parser to begin evaluating that expression. That's annoying as I just want a user to input an expression, press enter and have that expression evaluated.

Now w.r.t. SableCC4, am I understanding correctly that I need to use an explicit lookahead requirement of 'None'? Using the grammar below, how would read expressions from standard input and have the user entering return trigger the parsing of his/her expression. Thanks for any help.


Tokens
    tone = 'q';
    ttwo = 'w';
    tthree = 'e';
    tfour = 'r';

Productions
   
    expr =   {f}    first |
                {s}    second;
   
    first =    {one}    tone |
                {two}    ttwo;
    
    second =     {three} tthree |
                      {four} tfour;



Be smarter than spam. See how smart SpamGuard is at giving junk email the boot with the All-new Yahoo! Mail
_______________________________________________
SableCC-Discussion mailing list
SableCC-Discussion@...
http://lists.sablecc.org/listinfo/sablecc-discussion