Starting from:

$30

Lab 2.1 Reinforce LEX and Use of User Defined Variables Solution

Problem







A simple lex program was given that needed to be fixed. The goal of the program was to print the contents of a file except for what is written in comments. If any comments had errors, then the program is to print the debug error along with the line number that the error occurred on.




Two things needed to be added. The first addition was that the format string %d needed to be passed an integer. The integer used was newline which is a counter that counts the current line number. The second addition was the directive for the newline character \n such that when a newline was found, the counter newline was incremented by one and a newline is printed.






More products