r/programminghomework • u/florvas • Nov 08 '17
Help with recursion and BNF
Hello! I'm a third year comp sci student, and my class has been covering random IoT nonsense for the last month. Out of left field all of a sudden we're doing programming for the first time in about a year, and I'm struggling because we seem to have skipped a few steps. My assignment is as follows:
"Your assignment is to create or improve on the code that processes a simple expression: 1 + 5 * 8 / 2 - 8 The code MUST use recursion - and matches the BNF grammar. Look for methods <term>, <simple_expression>, <factor>."
I also have extra credit in the form of:
"You can get extra credit if you write the Lexical Analyzer - that will take arbitrary typed in text. (with or without error correction). (e.g., what do you do with 1 3 4 * x , as it's syntactically wrong and breaks the parser.)"
We haven't once touched on lexical analysis, BNF or recursion, and even after looking up recursion I'm completely lost here.
View all comments
Show parent comment
1
u/florvas Nov 09 '17
It's due friday, and however you want to help is greatly appreciated! I checked with the class and nobody seems to get it. Tutoring center doesn't help with this level of class either so I'm kinda up shit creek on this one