0

Problem with EOF for tokenizer

Iā€™m trying to create a tokenizer(or lexer) that tokenizes what you input, basically taking whatā€™s in parenthesis or quotations, and running code using that information, but iā€™m getting a syntax error. Try running the code and inputting something random, an error will appear. Why is this showing up and more importantly, how do I fix it? If someone could help me I would be very grateful. https://code.sololearn.com/ciqc75bOKAWG/?ref=app

27th Jul 2022, 12:41 AM
blazer!
blazer! - avatar
5 Answers
+ 2
blazer! the line 95 (the one above above the error line) is missing a closing parenthesis.
27th Jul 2022, 3:20 PM
Brian
Brian - avatar
+ 4
Hi, blazer! When you use input() in a while loop like this: while True: input() ā€¦ n SoloLearns app, you get EOFError. So you have to catch the error and handle it. Start looking at this file, about how you can handle multiple inputs in SoloLearns Playground: https://code.sololearn.com/cbPe32KfwQhF/?ref=app
27th Jul 2022, 3:17 AM
Per Bratthammar
Per Bratthammar - avatar
+ 2
On Sololearn this code is guaranteed to end with an EOF (End Of File) error because it takes input inside an infinite loop. Console programs on Sololearn take all input before running the program and cannot run interactively. You can fix it by providing a command that the user can add to exit the loop.
27th Jul 2022, 3:16 AM
Brian
Brian - avatar
+ 1
thank you!!
27th Jul 2022, 3:39 PM
blazer!
blazer! - avatar
0
Thank you guys, that fixed it, but when I tried to add a few things it still isnt working, it is always in the same line, no matter what I write on the line.
27th Jul 2022, 2:44 PM
blazer!
blazer! - avatar