Closed
Labels
questionA question, so neither a bug nor a enhancement proposal.
Description
When running java -jar jplag.jar -l javascript dirs -bc basecode, jplag shows results in browser but also many ANTLR errors, such as
2025-03-27-04:44:52_500 [ERROR] AntlrLoggerErrorListener - ANTLR error - line 23:0 mismatched input '}' expecting {'[', '(', '=', '?', ':', '.', '++', '--', '+', '-', '!', '*', '/', '%', '>>', '<<', '>>>', '<', '>', '<=', '>=', '==', '!=', '===', '!==', '&', '^', '|', '&&', '||', '*=', '/=', '%=', '+=', '-=', '<<=', '>>=', '>>>=', '&=', '^=', '|=', 'instanceof', 'in', 'as', BackTick}
Is the result reliable regardless?
macOS 15.3.2, M1 Pro.
Metadata
Metadata
Assignees
Labels
questionA question, so neither a bug nor a enhancement proposal.
Activity
tsaglam commentedon Mar 31, 2025
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, that ANTLR returns an incorrect parse tree due to the error.
[-]ANTLR errors[/-][+]ANTLR errors -- validity of results[/+]