On-the-Fly Syntax Highlighting using Neural Networks

08/04/2022
by   Marco Edoardo Palma, et al.
0

With the presence of online collaborative tools for software developers, source code is shared and consulted frequently, from code viewers to merge requests and code snippets. Typically, code highlighting quality in such scenarios is sacrificed in favor of system responsiveness. In these on-the-fly settings, performing a formal grammatical analysis of the source code is not only expensive, but also intractable for the many times the input is an invalid derivation of the language. Indeed, current popular highlighters heavily rely on a system of regular expressions, typically far from the specification of the language's lexer. Due to their complexity, regular expressions need to be periodically updated as more feedback is collected from the users and their design unwelcome the detection of more complex language formations. This paper delivers a deep learning-based approach suitable for on-the-fly grammatical code highlighting of correct and incorrect language derivations, such as code viewers and snippets. It focuses on alleviating the burden on the developers, who can reuse the language's parsing strategy to produce the desired highlighting specification. Moreover, this approach is compared to nowadays online syntax highlighting tools and formal methods in terms of accuracy and execution time, across different levels of grammatical coverage, for three mainstream programming languages. The results obtained show how the proposed approach can consistently achieve near-perfect accuracy in its predictions, thereby outperforming regular expression-based strategies.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
11/09/2022

Syntax-Aware On-the-Fly Code Completion

Code completion aims to help improve developers' productivity by suggest...
research
09/05/2023

Parsing Fortran-77 with proprietary extensions

Far from the latest innovations in software development, many organizati...
research
01/20/2021

LightSys: Lightweight and Efficient CI System for Improving Integration Speed of Software

The complexity and size increase of software has extended the delay for ...
research
03/21/2021

Language-Agnostic Representation Learning of Source Code from Structure and Context

Source code (Context) and its parsed abstract syntax tree (AST; Structur...
research
01/28/2020

Why Should Anyone use Colours? or, Syntax Highlighting Beyond Code Snippets

Syntax highlighting in the form of colours and font diversification, is ...
research
07/22/2020

DeepClone: Modeling Clones to Generate Code Predictions

During software development, programmers often tend to reuse the code fo...
research
04/20/2023

Novice programmers strategies for online resource use and their impact on source code

Websites are frequently used by programmers to support the development p...

Please sign up or login with your details

Forgot password? Click here to reset