Sample

Schnappinger/jsweet/org.jsweet.input.typescriptdef.parser.GenParser

Human rating uses the original dataset scale.

Human3.92
Lines29

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett0.4240–1; higher is more readable
77.6Δ 20.3
Scalabrino0.7160–1; higher is more readable
42.1Δ 15.1
Dorn0.3350–1; higher is more readable
50.8Δ 6.4
Mi0.0830–1; higher is more readable
9.6Δ 47.7
LLOC3Logical lines; fewer is more readable
91.1Δ 33.8
DeepSeek V4 Pro17.330–20; mean of three runs
73.9Δ 16.7
GPT-6.1 Sol180–20; mean of three runs
73.8Δ 16.5
BTTF0.6750–1; higher is more readable
74.3Δ 17.0
Human3.921–4; original rating
57.3

Views

Source code

/* * TypeScript definitions to Java translator - http://www.jsweet.org * Copyright (C) 2015 CINCHEO SAS <renaud.pawlak@cincheo.fr> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package org.jsweet.input.typescriptdef.parser; public class GenParser { public static void main(String[] args) throws Exception { java_cup.Main.main(new String[] { "-expect", "0", "-package", "org.jsweet.input.typescriptdef.parser", "-expect", "0", "-parser", "TypescriptDefParser", "typescriptdef.cup" }); JFlex.Main.main(new String[] { "typescriptdef.lex" }); } }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.395.918−13.065
Source linesThe number of non-empty source lines.29+11.6
Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value.5.141−7.711

Intercept 8.87 + feature contributions = -0.306 (log-odds).
Score = sigmoid(-0.306) = 0.424.

Score0.716

Feature contributions

FeatureValueContribution
(log-odds)
Identifier layout (horizontal)How rapidly the visual pattern of identifier characters changes from left to right. It measures spatial frequency, not the meaning of the names.154−2.858
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.154+1.68
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.032+0.633
Indentation frequencyHow rapidly indentation changes from line to line.12−0.322
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.12+0.145
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.30−0.026
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.28.819−0.007

Intercept 0.07 + feature contributions = -0.684 (log-odds).
Score = sigmoid(-0.684) = 0.335.

Score0.083
Score3
Run 1

The code is concise and well-structured with a clear purpose, generating parser and lexer files. It has minimal nesting and one action per method, aiding readability. However, some ambiguity exists: the repeated '-expect 0' flag in the argument array could confuse readers, and the long parameter list lacks formatting. Magic strings for file names and package names slightly diminish clarity, though the overall intent is straightforward.

Run 2

The code is highly readable due to its simplicity and clarity. It has a logical structure with a single class and a concise main method. Nesting is minimal, with only method calls inside an array. The intent is unambiguous: generating parser files via Java CUP and JFlex. Code length is appropriate, with no unnecessary verbosity. Action granularity is good, with one logical operation per line. Reading flow is natural, progressing from the cup generation to the lexer generation. Minor deductions: the duplicated '-expect', '0' argument is slightly redundant, and the long single-line file paths and arguments reduce readability slightly. Overall, the code is clear and maintainable.

Run 3

The code is highly readable due to its simple structure, clear intent, and minimal nesting. The main method directly invokes two parser-generation tools with explicit string arguments, and each tool call occupies its own logical block. Action granularity is reasonable, though the java_cup.Main.main line contains many arguments on one line, slightly reducing readability. The license header adds length but is standard boilerplate and clearly separated from the logic. Overall, the code is concise, flat, and straightforward with no ambiguity.

Run 1

Code Structure: A single class and entry point logically group the parser and lexer generation steps. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: Generator calls and filenames convey the purpose, although the abbreviated class name and unexplained command-line options slightly reduce clarity. Code length: The implementation is concise; the lengthy license header is conventional rather than unnecessary logic. Action granularity: Each generator invocation is a separate statement, keeping actions distinct. Reading flow: The two calls follow a straightforward sequence, but the long argument-array line and duplicated '-expect', '0' option introduce minor visual clutter.

Run 2

Code Structure: A single class and entry point logically group parser and lexer generation. Nesting: No nested control flow, making the code easy to scan. Clarity of intent: Class and tool names reveal the purpose, though the generation sequence and command-line options lack explanation; the duplicated '-expect', '0' pair is distracting. Code length: The implementation is concise; the lengthy license header is standard boilerplate rather than unnecessary implementation. Action granularity: Each statement performs one generation action, although the parser invocation packs many arguments onto a long line. Reading flow: Execution proceeds naturally from parser generation to lexer generation, with only the dense argument formatting slightly interrupting readability.

Run 3

Code Structure: A simple class with one entry point logically groups parser and lexer generation. Nesting: Minimal nesting makes the code easy to scan. Clarity of intent: Generator names, arguments, and filenames communicate the purpose, though GenParser is abbreviated and the duplicated '-expect', '0' option is distracting. Code length: The executable code is concise; the lengthy license header is standard boilerplate rather than unnecessary implementation. Action granularity: Each generator invocation is a separate statement, although the first invocation packs many arguments into a long line. Reading flow: Parser generation followed by lexer generation is straightforward, but cleaner argument formatting would improve readability.