0

I need to create a program that is able to detect syntax error in C language programming. Let's say the grammar should be

printf("statement");

How could I create an interface that is able to detect if there's any error in the coding? The output should be "Syntax error!Please try again" or "Well done!No syntax error"

My teacher advice me to use stringtokenizer. Can anyone help me with this? I dont mind if the user need to space for each input such as:

**printf** (space) **("** (space) **statement** (space) **")** (space) **;**
sharkbait
  • 2,980
  • 16
  • 51
  • 89

1 Answers1

0

Yes. the tokenizer function [in c] you are looking for is strtok_r(). Please check the details regarding the usage of this function in the man page here.

However, this is going to be a tricky job. Best of luck with your efforts.

Sourav Ghosh
  • 133,132
  • 16
  • 183
  • 261