Syntax Error

14,000,000 Leading Edge Experts on the ideXlab platform

Scan Science and Technology

Contact Leading Edge Experts & Companies

Scan Science and Technology

Contact Leading Edge Experts & Companies

The Experts below are selected from a list of 5796 Experts worldwide ranked by ideXlab platform

Luke A D Hutchison - One of the best experts on this subject based on the ideXlab platform.

  • pika parsing reformulating packrat parsing as a dynamic programming algorithm solves the left recursion and Error recovery problems
    arXiv: Programming Languages, 2020
    Co-Authors: Luke A D Hutchison
    Abstract:

    A recursive descent parser is built from a set of mutually-recursive functions, where each function directly implements one of the nonterminals of a grammar. A packrat parser uses memoization to reduce the time complexity for recursive descent parsing from exponential to linear in the length of the input. Recursive descent parsers are extremely simple to write, but suffer from two significant problems: (i) left-recursive grammars cause the parser to get stuck in infinite recursion, and (ii) it can be difficult or impossible to optimally recover the parse state and continue parsing after a Syntax Error. Both problems are solved by the pika parser, a novel reformulation of packrat parsing as a dynamic programming algorithm, which requires parsing the input in reverse: bottom-up and right to left, rather than top-down and left to right. This reversed parsing order enables pika parsers to handle grammars that use either direct or indirect left recursion to achieve left associativity, simplifying grammar writing, and also enables optimal recovery from Syntax Errors, which is a crucial property for IDEs and compilers. Pika parsing maintains the linear-time performance characteristics of packrat parsing as a function of input length. The pika parser was benchmarked against the widely-used Parboiled2 and ANTLR4 parsing libraries. The pika parser performed significantly better than the other parsers for an expression grammar, although for a complex grammar implementing the Java language specification, a large constant performance impact was incurred per input character. Therefore, if performance is important, pika parsing is best applied to simple to moderate-sized grammars, or to very large inputs, if other parsing alternatives do not scale linearly in the length of the input. Several new insights into precedence, associativity, and left recursion are presented.

Hutchison, Luke A. D. - One of the best experts on this subject based on the ideXlab platform.

  • Pika parsing: reformulating packrat parsing as a dynamic programming algorithm solves the left recursion and Error recovery problems
    2020
    Co-Authors: Hutchison, Luke A. D.
    Abstract:

    A recursive descent parser is built from a set of mutually-recursive functions, where each function directly implements one of the nonterminals of a grammar. A packrat parser uses memoization to reduce the time complexity for recursive descent parsing from exponential to linear in the length of the input. Recursive descent parsers are extremely simple to write, but suffer from two significant problems: (i) left-recursive grammars cause the parser to get stuck in infinite recursion, and (ii) it can be difficult or impossible to optimally recover the parse state and continue parsing after a Syntax Error. Both problems are solved by the pika parser, a novel reformulation of packrat parsing as a dynamic programming algorithm, which requires parsing the input in reverse: bottom-up and right to left, rather than top-down and left to right. This reversed parsing order enables pika parsers to handle grammars that use either direct or indirect left recursion to achieve left associativity, simplifying grammar writing, and also enables optimal recovery from Syntax Errors, which is a crucial property for IDEs and compilers. Pika parsing maintains the linear-time performance characteristics of packrat parsing as a function of input length. The pika parser was benchmarked against the widely-used Parboiled2 and ANTLR4 parsing libraries. The pika parser performed significantly better than the other parsers for an expression grammar, although for a complex grammar implementing the Java language specification, a large constant performance impact was incurred per input character. Therefore, if performance is important, pika parsing is best applied to simple to moderate-sized grammars, or to very large inputs, if other parsing alternatives do not scale linearly in the length of the input. Several new insights into precedence, associativity, and left recursion are presented.Comment: Submitted to AC

Mascarenhas Fabio - One of the best experts on this subject based on the ideXlab platform.

  • Automatic Syntax Error Reporting and Recovery in Parsing Expression Grammars
    2019
    Co-Authors: De Medeiros, Sérgio Queiroz, Junior, Gilney De Azevedo Alvez, Mascarenhas Fabio
    Abstract:

    Error recovery is an essential feature for a parser that should be plugged in Integrated Development Environments (IDEs), which must build Abstract Syntax Trees (ASTs) even for syntactically invalid programs in order to offer features such as automated refactoring and code completion. Parsing Expressions Grammars (PEGs) are a formalism that naturally describes recursive top-down parsers using a restricted form of backtracking. Labeled failures are a conservative extension of PEGs that adds an Error reporting mechanism for PEG parsers, and these labels can also be associated with recovery expressions to provide an Error recovery mechanism. These expressions can use the full expressivity of PEGs to recover from syntactic Errors. Manually annotating a large grammar with labels and recovery expressions can be difficult. In this work, we present two approaches, Standard and Unique, to automatically annotate a PEG with labels, and to build their corresponding recovery expressions. The Standard approach annotates a grammar in a way similar to manual annotation, but it may insert labels incorrectly, while the Unique approach is more conservative to annotate a grammar and does not insert labels incorrectly. We evaluate both approaches by using them to generate Error recovering parsers for four programming languages: Titan, C, Pascal and Java. In our evaluation, the parsers produced using the Standard approach, after a manual intervention to remove the labels incorrectly added, gave an acceptable recovery for at least 70% of the files in each language. By it turn, the acceptable recovery rate of the parsers produced via the Unique approach, without the need of manual intervention, ranged from 41% to 76%

  • Syntax Error Recovery in Parsing Expression Grammars
    'Association for Computing Machinery (ACM)', 2018
    Co-Authors: Medeiros Sérgio, Mascarenhas Fabio
    Abstract:

    Parsing Expression Grammars (PEGs) are a formalism used to describe top-down parsers with backtracking. As PEGs do not provide a good Error recovery mechanism, PEG-based parsers usually do not recover from Syntax Errors in the input, or recover from Syntax Errors using ad-hoc, implementation-specific features. The lack of proper Error recovery makes PEG parsers unsuitable for using with Integrated Development Environments (IDEs), which need to build syntactic trees even for incomplete, syntactically invalid programs. We propose a conservative extension, based on PEGs with labeled failures, that adds a Syntax Error recovery mechanism for PEGs. This extension associates recovery expressions to labels, where a label now not only reports a Syntax Error but also uses this recovery expression to reach a synchronization point in the input and resume parsing. We give an operational semantics of PEGs with this recovery mechanism, and use an implementation based on such semantics to build a robust parser for the Lua language. We evaluate the effectiveness of this parser, alone and in comparison with a Lua parser with automatic Error recovery generated by ANTLR, a popular parser generator.Comment: Published on ACM Symposium On Applied Computing 201

Fernando Saenzperez - One of the best experts on this subject based on the ideXlab platform.

  • relational calculi in a deductive system
    Expert Systems With Applications, 2018
    Co-Authors: Fernando Saenzperez
    Abstract:

    Abstract This work describes the addition of relational calculus languages in the deductive database system DES. Based on first-order logic, such languages admit a clean logical reading of queries, providing truly declarativeness, in contrast to other languages based on logic such as Prolog (a classical language used to build expert systems). Interesting properties as termination (for finite relations) and recursion are ensured because the DES deductive engine is used for solving relational calculus queries. Recursion in particular opens a brand new ream of applications (social networks, data warehouses, ...) for relational calculus languages which were unmanageable up to now. Since the DES system was targeted at teaching, we have also make a special emphasis on providing a practical system for students by providing appropriate Syntax Error feedback in a system supporting different languages (including relational algebra, SQL and Datalog).

Lohmann Steffen - One of the best experts on this subject based on the ideXlab platform.

  • RDF Doctor: A Holistic Approach for Syntax Error Detection and Correction of RDF Data
    2019
    Co-Authors: Hemid Ahmad, Halilaj Lavdim, Khiat Abderrahmane, Lohmann Steffen
    Abstract:

    Over the years, the demand for interoperability support between diverse applications has significantly in- creased. The Resource Definition Framework (RDF), among other solutions, is utilized as a data modeling language which allows for encoding the knowledge from various domains in a unified representation. More- over, a vast amount of data from heterogeneous data sources are continuously published in documents using the RDF format. Therefore, these RDF documents should be syntactically correct in order to enable software agents performing further processing. Albeit, a number of approaches have been proposed for ensuring Error-free RDF documents, commonly they are not able to identify all Syntax Errors at once by failing on the first encountered Error. In this paper, we tackle the problem of simultaneous Error identification, and propose RDF-Doctor, a holistic approach for detecting and resolving syntactic Errors in a semi-automatic fashion. First, we define a comprehensive list of Errors that can be detected along with customized Error messages to allow users for a better understanding of the actual Errors. Next, a subset of syntactic Errors is corrected automatically based on matching them with predefined Error messages. Finally, for a particular number of Errors, customized and meaningful messages are delivered to users to facilitate the manual corrections process. The results from empirical evaluations provide evidence that the presented approach is able to effectively detect a wide range of Syntax Errors and automatically correct a large subset of them