ANTLR errors -- validity of results #2275
-
When running
Is the result reliable regardless? macOS 15.3.2, M1 Pro. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
It depends. We use different means of parsing files of programming languages. For many languages, we use ANTLR grammars.
When the ANTLR grammar fails to parse a program (e.g., due to a syntax error), it may still return an incorrect parse tree, and JPlag can still (partially) check that program for plagiarism.
However, if a program cannot be parsed at all, this particular program will then be omitted.
For example, consider these two programs:
If I now introduce a syntax error in line 19 (remove bracket, mistype print):
Note that due to the incorrect parsing, some code can no langer be matched. However, it is not the changed line (19), it is a later part of the program. The reason is, th…