Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues within the language module architecture #454

Closed
6 of 10 tasks
tsaglam opened this issue Jun 10, 2022 · 3 comments
Closed
6 of 10 tasks

Issues within the language module architecture #454

tsaglam opened this issue Jun 10, 2022 · 3 comments
Labels
enhancement Issue/PR that involves features, improvements and other changes language PR / Issue deals (partly) with new and/or existing languages for JPlag minor Minor issue/feature/contribution/change

Comments

@tsaglam
Copy link
Member

tsaglam commented Jun 10, 2022

This issue is meant to collect problems with the design of the language modules.
Known problems are:

  • The name frontend is not very good, as they are technically not frontends but rather language modules for parsing and tokenization.
  • The token constants should not be constants in an interface with manually defined IDs, they should be enum literals in an enum, where each language should have its own enum and the ordinal is the ID.
  • The common tokens FILE_END and SEPARATOR_TOKEN should not be identified via the index but rather via methods in the token enums (prescribed by a common interface which should be part of the front-end utils).
  • Most frontends will not need their own token classes, except the emf frontend.
  • The language interface should offer default methods for method signatures that are often implemented the same way (e.g. usesIndex() with false, isPreformatted() with true)
  • Language.parse() should return a result object with both the tokens and the error status (as suggested below)
  • Language modules should provide readme files that explain the design rationales of the token extraction.
  • An abstract parser class should offer shared functionality among frontends
  • The parser should be instantiated per submissions not globally per language.
  • The language facades should not be named the same (API-breaking change!!!)
@tsaglam tsaglam added enhancement Issue/PR that involves features, improvements and other changes minor Minor issue/feature/contribution/change language PR / Issue deals (partly) with new and/or existing languages for JPlag labels Jun 10, 2022
@tsaglam tsaglam added this to the v4.0.0 milestone Jun 10, 2022
@Alberth289346
Copy link
Contributor

// submission.java line 258
        tokenList = language.parse(submissionRootFile, relativeFilePaths);
        if (!language.hasErrors()) {

Just passing by, saw this issue, remembered the above interface weirdness.

It's parsing a submission, and you get the token list. Then separately you must query the error status.
I think a better solution is to pass both back together from the parse call by wrapping them into an class or so.

@tsaglam
Copy link
Member Author

tsaglam commented Aug 24, 2022

Some of these issues are currently being addressed by @JanWittler, his PR will follow soon.

@tsaglam tsaglam changed the title Issues within the frontend architecture Issues within the language module architecture Sep 15, 2022
@tsaglam tsaglam mentioned this issue Sep 15, 2022
4 tasks
@sebinside sebinside removed this from the v4.0.0 milestone Sep 29, 2022
@JanWittler JanWittler removed their assignment Oct 17, 2022
@tsaglam
Copy link
Member Author

tsaglam commented Mar 17, 2023

Suceeded by #983.

@tsaglam tsaglam closed this as completed Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issue/PR that involves features, improvements and other changes language PR / Issue deals (partly) with new and/or existing languages for JPlag minor Minor issue/feature/contribution/change
Projects
None yet
Development

No branches or pull requests

4 participants