Skip to content

ANTLR errors -- validity of results #2267

Closed

Description

@erikmartinessanches

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.

Activity

  1. tsaglam commented on Mar 31, 2025

    @tsaglam
    Member

    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:

    Image

    If I now introduce a syntax error in line 19 (remove bracket, mistype print):

    Image

    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.

  2. changed the title [-]ANTLR errors[/-] [+]ANTLR errors -- validity of results[/+] on Mar 31, 2025
  3. locked and limited conversation to collaborators on Mar 31, 2025
  4. converted this issue into a discussion #2275 on Mar 31, 2025
  5. added
    question
    on Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions