JPlag icon indicating copy to clipboard operation
JPlag copied to clipboard

Issues within the language module architecture

Open tsaglam opened this issue 2 years ago • 2 comments

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

  • [x] The name frontend is not very good, as they are technically not frontends but rather language modules for parsing and tokenization.
  • [x] 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).
  • [x] Most frontends will not need their own token classes, except the emf frontend.
  • [x] 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)
  • [ ] Frontends should provide readme files that explain the design rationales of the token extraction.
  • [ ] An abstract parser class should offer shared functionality among frontends
  • [x] Language.parse() should return a result object with both the tokens and the error status (as suggested below)

tsaglam avatar Jun 10 '22 13:06 tsaglam

// 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.

Alberth289346 avatar Jun 20 '22 17:06 Alberth289346

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

tsaglam avatar Aug 24 '22 12:08 tsaglam

Suceeded by #983.

tsaglam avatar Mar 17 '23 11:03 tsaglam