Results 1  10
of
10
A Family of Syntax Definition Formalisms
 PROGRAMMING RESEARCH GROUP, UNIVERSITY OF AMSTERDAM
, 1997
"... ..."
Precedences in Specifications and Implementations of Programming Languages
 Theoretical Computer Science
, 1991
"... Although precedences are often used to resolve ambiguities in programming language descriptions, there has been no parserindependent definition of languages which are generated by grammars with precedence rules. This paper gives such a definition for a subclass of contextfree grammars. The defi ..."
Abstract

Cited by 14 (1 self)
 Add to MetaCart
(Show Context)
Although precedences are often used to resolve ambiguities in programming language descriptions, there has been no parserindependent definition of languages which are generated by grammars with precedence rules. This paper gives such a definition for a subclass of contextfree grammars. The definition is shown to be equivalent to the implicit definition an operator precedence parser gives. A problem with a language containing infix, prefix and postfix operators of different precedences is that the wellknown algorithm, which transforms a grammar with infix operator precedences to an ordinary unambiguous contextfree grammar, does not work. This paper gives an algorithm that works also for prefix and postfix operators, and the correctness of it is proved. An application of the algorithm is also presented. 1 Introduction Precedences are used in many language descriptions to resolve ambiguities. The reason for resolving ambiguities with precedences, instead of using an unambig...
A Case Study in Optimizing Parsing Schemata by Disambiguation Filters
 Proceedings Accolade95
"... Disambiguation methods for contextfree grammars enable concise specification of programming languages by ambiguous grammars. A disambiguation filter is a function that selects a subset from a set of parse treesthe possible parse trees for an ambiguous sentence. The framework of filters provides ..."
Abstract

Cited by 9 (5 self)
 Add to MetaCart
Disambiguation methods for contextfree grammars enable concise specification of programming languages by ambiguous grammars. A disambiguation filter is a function that selects a subset from a set of parse treesthe possible parse trees for an ambiguous sentence. The framework of filters provides a declarative description of disambiguation methods independent of parsing. Although filters can be implemented straightforwardly as functions that prune the parse forest produced by some generalized parser, this can be too inefficient for practical applications. In this paper the optimization of parsing schemata, a framework for highlevel description of parsing algorithms, by disambiguation filters is considered in order to find efficient parsing algorithms for declaratively specified disambiguation methods. As a case study the optimization of the parsing schema of Earley's parsing algorithm by two filters is investigated. The main result is a technique for generation of efficient LRlike p...
Ordered ContextFree Grammars
"... Contextfree grammars (CFGs) provide an intuitive and powerful formalism for describing the syntactic structure of parsable input streams. Unfortunately, existing online parsing algorithms for such streams admit only a subset of possible CFG descriptions. Theoretically, it is possible to parse any ..."
Abstract

Cited by 3 (1 self)
 Add to MetaCart
(Show Context)
Contextfree grammars (CFGs) provide an intuitive and powerful formalism for describing the syntactic structure of parsable input streams. Unfortunately, existing online parsing algorithms for such streams admit only a subset of possible CFG descriptions. Theoretically, it is possible to parse any deterministic contextfree language (CFL) in a single pass, as long as the grammar describing the CFL belongs to the LR(k), k ≥ 1 subset of CFGs. However, obtaining a suitable LR(k) description for a language is not an easy task — especially when k = 1 — and usually entails an increase in complexity of the rewritten CFG. More importantly, such rewriting inevitably obfuscates the syntactic structure of the language and complicates the placement of semantic bindings. Instead of searching for yet another subclass of CFGs amenable to parsing, we propose to augment the definition of the CFG itself by allowing associativity and precedence to be specified for each production in the grammar. We call the resulting formalism an ordered contextfree grammar (OCFG). Compared to ordinary contextfree grammars, OCFGs can often reduce the number of distinct derivation trees for a given sentence in a CFL; those parse trees that remain can be arranged into a strict partial order. These characteristics make it very easy to craft unambiguous descriptions for contextfree languages using OCFGs. At the same time, parsers constructed from OCFGs rely on deterministic pushdown automata and are structurally identical to their CFG counterparts. For the wellknown LR(k) and LALR(k) subsets of CFGs, we define analogous subsets of OCFGs, called LRP(k) and LALRP(k), and illustrate how these may be used for defining programming language constructs much more succinctly. Finally, we briefly describe 1 the BerthaTM parser generator designed to construct bottomup parsers from LALRP(1) grammar specifications. 1
From ContextFree Grammars With Priorities to Character Class Grammars
, 1997
"... ... In this paper we introduce a grammar transformation that translates a contextfree grammar with priorities to a character class grammar that does only generate trees without priority conflicts. The transformed grammar has the property that each production corresponds to a production in the origi ..."
Abstract

Cited by 2 (0 self)
 Add to MetaCart
... In this paper we introduce a grammar transformation that translates a contextfree grammar with priorities to a character class grammar that does only generate trees without priority conflicts. The transformed grammar has the property that each production corresponds to a production in the original grammar and that no extra productions are used. The parse trees over the transformed grammar are therefore isomorphic to parse trees over the original grammar.
Lemma 16.2
, 1993
"... urned by Algorithm B. Proof: The result is trivial if t 0 = t 1 , for then also t 0 0 = t 0 1 , so the projection of (t 0 0 ; t 0 1 ) is ?, which is returned in step B.1 Thus we may assume that t 0 6= t 1 . Notice that this does not in general imply t 0 0 6= t 0 1 . However, if t 0 0 ..."
Abstract
 Add to MetaCart
urned by Algorithm B. Proof: The result is trivial if t 0 = t 1 , for then also t 0 0 = t 0 1 , so the projection of (t 0 0 ; t 0 1 ) is ?, which is returned in step B.1 Thus we may assume that t 0 6= t 1 . Notice that this does not in general imply t 0 0 6= t 0 1 . However, if t 0 0 6= t 0 1 and a 0\Gamma is the longest common prefix of the action sequences of t 0 0 and t 0 1 , then state(t 0 ; ja 0\Gamma j) = state(t 1<F13.
Precedences for Conctypes
, 1993
"... We consider again a user defined syntax feature, the conctype, which is a new datatype construction. An embedded language can easily be introduced into a programming language using conctypes, and computations are easily expressed using the concrete syntax and a special pattern matching form. Conte ..."
Abstract
 Add to MetaCart
We consider again a user defined syntax feature, the conctype, which is a new datatype construction. An embedded language can easily be introduced into a programming language using conctypes, and computations are easily expressed using the concrete syntax and a special pattern matching form. Contextfree grammars serve as a basis for the definition of the new syntax. A problem that is investigated in this paper is how to use precedences to resolve ambiguity. The way precedences are used in LRparsers is sometimes unnatural and is hard to translate to other parsing techniques. We isolate one kind of ambiguity which can be resolved with precedence rules and show that it is easy for a user to augment a grammar with precedence rules. We define the generated language for such a grammar in terms of an attribute grammar and show that it is easy to automatically construct a parser that recognizes the language. 1 Conctypes In a previous paper [APS88] we described a user defined syntax featu...
More Intuitive BottomUp Parsing
, 1999
"... Although bottomup parsing techniques are sufficiently powerful for most compiler construction tasks, the crafting of suitable grammar specifications can be a difficult and elusive process. The lack of proper abstraction mechanisms in specification metalanguages themselves often exacerbates these di ..."
Abstract
 Add to MetaCart
Although bottomup parsing techniques are sufficiently powerful for most compiler construction tasks, the crafting of suitable grammar specifications can be a difficult and elusive process. The lack of proper abstraction mechanisms in specification metalanguages themselves often exacerbates these difficulties. We present Bertha, a prototype parser generator designed to address these and other concerns. Bertha is built upon the notion of ordered contextfree grammars, a formal and systematic augmentation of contextfree grammars with associativity and precedence information, that affords it greater expressivity. Furthermore, Bertha’s input metalanguage allows for hierarchical grammar and symbol definitions, facilitating the use of closures and inherited attributes. Finally, all grammar specifications are typesafe and properly encapsulated, and represent a minimal departure from the underlying Java TM language. 1