453 research outputs found
Generalizing input-driven languages: theoretical and practical benefits
Regular languages (RL) are the simplest family in Chomsky's hierarchy. Thanks
to their simplicity they enjoy various nice algebraic and logic properties that
have been successfully exploited in many application fields. Practically all of
their related problems are decidable, so that they support automatic
verification algorithms. Also, they can be recognized in real-time.
Context-free languages (CFL) are another major family well-suited to
formalize programming, natural, and many other classes of languages; their
increased generative power w.r.t. RL, however, causes the loss of several
closure properties and of the decidability of important problems; furthermore
they need complex parsing algorithms. Thus, various subclasses thereof have
been defined with different goals, spanning from efficient, deterministic
parsing to closure properties, logic characterization and automatic
verification techniques.
Among CFL subclasses, so-called structured ones, i.e., those where the
typical tree-structure is visible in the sentences, exhibit many of the
algebraic and logic properties of RL, whereas deterministic CFL have been
thoroughly exploited in compiler construction and other application fields.
After surveying and comparing the main properties of those various language
families, we go back to operator precedence languages (OPL), an old family
through which R. Floyd pioneered deterministic parsing, and we show that they
offer unexpected properties in two fields so far investigated in totally
independent ways: they enable parsing parallelization in a more effective way
than traditional sequential parsers, and exhibit the same algebraic and logic
properties so far obtained only for less expressive language families
Syntactic analysis of LR(k) languages
PhD ThesisA method of syntactic analysis, termed LA(m)LR(k), is discussed
theoretically. Knuth's LR(k) algorithm is included as the special
case m = k. A simpler variant, SLA(m)LR(k) is also described, which
in the case SLA(k)LR(O) is equivalent to the SLR(k) algorithm as
defined by DeRemer. Both variants have the LR(k) property of
immediate detection of syntactic errors.
The case m = 1 k = 0 is examined in detail, when the methods
provide a practical parsing technique of greater generality than
precedence methods in current use. A formal comparison is made with
the weak precedence algorithm.
The implementation of an SLA(1)LR(O) parser (SLR) is described,
involving numerous space and time optimisations. Of importance is a
technique for bypassing unnecessary steps in a syntactic derivation.
Direct comparisons are made, primarily with the simple precedence
parser of the highly efficient Stanford AlgolW compiler, and confirm
the practical feasibility of the SLR parser.The Science Research Council
A survey of compiler development aids
A theoretical background was established for the compilation process by dividing it into five phases and explaining the concepts and algorithms that underpin each. The five selected phases were lexical analysis, syntax analysis, semantic analysis, optimization, and code generation. Graph theoretical optimization techniques were presented, and approaches to code generation were described for both one-pass and multipass compilation environments. Following the initial tutorial sections, more than 20 tools that were developed to aid in the process of writing compilers were surveyed. Eight of the more recent compiler development aids were selected for special attention - SIMCMP/STAGE2, LANG-PAK, COGENT, XPL, AED, CWIC, LIS, and JOCIT. The impact of compiler development aids were assessed some of their shortcomings and some of the areas of research currently in progress were inspected
LR(k) sparse-parsers and their optimisation
PhD ThesisA method of syntactic analysis is developed which . .
is believed to surpass all known competitors in all major
respects.
I
The method is based upon that associated with the
LR(k) grammars but is faster because it bypasses all
reduction steps concerned with 'chain' productions. These
are freely selected productions which are considered
semantically irrelevant and whose right parts consist of
just a single symbol. The parses produced by the method
are 'sparse' in that they contain no references to chain
productions - they are termed 'chain-free' parses.
The CFLR(k) grammars are introduced as the largest
class which can be -Chain-F-ree parsed from -Le-ft to Right while looking ~ symbols ahead of the current point of the
parse. The properties of these grammars are examined in
detail and their relationship to the conventional LR(k)
grammars is explored. Techniques are presented for testing
grammars for the CFLR(k) property and for constructing
chain-free parsers for those grammars possessing the
property. Methods are also presented for. converting
ordinary LR(k) parsers into chain-free parsers.
CFLR(k) parsers are more widely applicable than
their LR(k) counterparts, are faster 'and provide the same
excellent detection of syntactic errors. Unfortunately they
also tend to be rather larger. A 'simple optimization is
presented which completely'overcomes this single disadvantage
without sacrificing any of the advantages of the
method.
These theoretical techniques are adapted to provide
truly practical chain-free parsers based on the conventional
SLR and,LALR parsing methods. Detailed consideration
is given to use of 'default reductions' and related
techniques for achd.evfng compact representations of these
parsers. The resulting chain-free parsers are not only
faster than their ordinary counterparts, but probably
smaller too. We believe their advantages are such that they
should substantially replace other parsing methods currently
used in programming language compilers
PSLR(1): Pseudo-Scannerless Minimal LR(1) for the Deterministic Parsing of Composite Languages
Composite languages are composed of multiple sub-languages. Examples include the parser specification languages read by parser generators like Yacc, modern extensible languages with complex layers of domain-specific sub-languages, and even traditional programming languages like C and C++. In this dissertation, we describe PSLR(1), a new scanner-based LR(1) parser generation system that automatically eliminates scanner conflicts typically caused by language composition. The fundamental premise of PSLR(1) is the pseudo-scanner, a scanner that only recognizes tokens accepted by the current parser state. However, use of the pseudo-scanner raises several unique challenges, for which we describe a novel set of solutions. One major challenge is that practical LR(1) parser table generation algorithms merge parser states, sometimes inducing incorrect pseudo-scanner behavior including new conflicts. Our solution is a new extension of IELR(1), an algorithm we have previously described for generating minimal LR(1) parser tables. Other contributions of our work include a robust system for handling the remaining scanner conflicts, a correction for syntax error handling mechanisms that are also corrupted by parser state merging, and a mechanism to enable scoping of syntactic declarations in order to further improve the modularity of sub-language specifications. While the premise of the pseudo-scanner has been described by other researchers independently, we expect our improvements to distinguish PSLR(1) as a significantly more robust scanner-based parser generation system for traditional and modern composite languages
Epsilon Precedence Grammars and Languages
The classes of simple and weak precedence grammars are generalized to include Īµ-rules (productions with the empty right parts). The descriptive power of epsilon simple precedence (ESP) grammars increases directly with the number of Īµ-rules permitted; the class of ESP grammars with no Īµ-rules, ESP0, is identical to the class of simple precedence grammars; ESP grammars with at most one Īµ-rule, ESP1, define a class of languages which properly includes the class of ESP0 languages, but is itself properly included in the class of deterministic, context-free languages. In general, ESP grammars having at most i Īµ-rules, ESPi, define a class of languages which is properly included in that defined by ESPi+1 grammars. This hierarchy of languages exhausts the deterministic context-free languages. The hierarchy of ESP languages is established using an iteration theorem which may be used to show that a given language is not ESPi for a given i.
An algorithm to convert arbitrary LR(1) grammars to equivalent epsilon weak precedence (EWP) grammars is developed.
The class of Viable Prefix EWP grammars is defined and it is shown that the EWP parser for every Viable Prefix EWP grammar detects syntactic errors at the earliest possible time. Also, it is established that every deterministic context-free language is defined by some Viable Prefix EWP grammar.
Finally, it is shown that the class of EWP grammars, while properly containing the class of Viable Prefix EWP grammars, is itself properly included in the well-known classes of context-free grammars with the Īµ-rules which define exactly the deterministic context-free languages
Parallel Natural Language Parsing: From Analysis to Speedup
Electrical Engineering, Mathematics and Computer Scienc
- ā¦