ACM Home Page
Please provide us with feedback. Feedback
Macros for context-free grammars
Full text PdfPdf (345 KB)
Source
International Conference on Principles and Practice of Declarative Programming archive
Proceedings of the 10th international ACM SIGPLAN conference on Principles and practice of declarative programming table of contents
Valencia, Spain
SESSION: Language issues table of contents
Pages 120-130  
Year of Publication: 2008
ISBN:978-1-60558-117-0
Authors
Peter Thiemann  Institut für Informatik, Universität Freiburg, Germany
Matthias Neubauer  Institut für Informatik, Universität Freiburg, Germany
Sponsors
SIGPLAN: ACM Special Interest Group on Programming Languages
ACM: Association for Computing Machinery
Publisher
ACM  New York, NY, USA
Bibliometrics
Downloads (6 Weeks): 4,   Downloads (12 Months): 64,   Citation Count: 0
Additional Information:

abstract   references   index terms   collaborative colleagues  

Tools and Actions: Request Permissions Request Permissions    Review this Article  
DOI Bookmark: Use this link to bookmark this Article: http://doi.acm.org/10.1145/1389449.1389465
What is a DOI?

ABSTRACT

Current parser generators are based on context-free grammars. Because such grammars lack abstraction facilities, the resulting specifications are often not easy to read. Fischer's macro grammars extend context-free grammars with macro-like productions thus providing the equivalent of procedural abstraction. However, their use is hampered by the lack of an efficient, off-the-shelf parsing technology for macro grammars.

We define specialization for macro grammars to enable reuse of parsing technology for context-free grammars while facilitating the specification of a language with a macro grammar. This specialization yields context-free rules, but it does not always terminate.

We present a sound and complete static analysis that applies to any macro grammar and decides whether specialization terminates for it and thus yields a (finite) context-free grammar. The analysis is based on an intuitive notion of self-embedding nonterminals, which is easy to check by hand.

We have implemented the analysis as part of a preprocessing tool that transforms a Yacc grammar extended with macro productions to a standard Yacc grammar.


REFERENCES

Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.

 
1
 
2
3
 
4
 
5
 
6
Compiler Resources, Inc. Yacc++ and the language objects library. http://world.std.com/~compres/, July 2004.
 
7
K. Culik and R. Cohen. LR-regular grammars¿an extension of LR(k) grammars. J. Comput. Syst. Sci., 7:66--96, 1973.
 
8
W. Damm. The IO- and OI-hierarchies. Theoretical Computer Science, 20(2):95--207, May 1982.
 
9
C. Donnelly and R. Stallman. Bison¿The YACC-compatible Parser Generator. Free Software Foundation, Boston, MA, Nov. 1995. Part of the Bison distribution.
 
10
ECMAScript Language Specification. http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf, Dec. 1999. ECMA International, ECMA-262, 3rd edition.
 
11
M. J. Fischer. Grammars with macro-like productions. In IEEE Conference Record of 9th Annual Symposium on Switching and Automata Theory, pages 131--142, 1968.
 
12
A. Gill and S. Marlow. Happy Manual. University of Glasgow, Department of Computing Science, 1995. Available via http://www.dcs.gla.ac.uk/fp/software/happy.html.
13
 
14
 
15
The GrammarForge. build parsing applications with confidence. http://www.thothic.com/downloads/MetaSFactSheet.pdf, 2005.
16
 
17
 
18
S. Heilbrunner. On the definition of ELR(k) and ELL(k) grammars. Acta Informatica, 11:169--176, 1979.
 
19
 
20
JavaCC the java parser generator. https://javacc.dev.java.net/.
 
21
S. C. Johnson. Yacc¿yet another compiler compiler. Technical Report 32, AT&T Bell Laboratories, Murray Hill, NJ, 1975.
 
22
23
 
24
25
 
26
 
27
 
28
S. Peyton Jones, editor. Haskell 98 Language and Libraries, The Revised Report. Cambridge University Press, 2003.
 
29
F. Pottier and Y. Régis-Gianas. Menhir reference manual. http://pauillac.inria.fr/~fpottier/menhir/manual.pdf, July 2007.
 
30
J. Rekers. Parser Generation for Interactive Environments. PhD thesis, University of Amsterdam, 1992.
 
31
S. D. Swierstra. Fast, error repairing parsing combinators. http://www.cs.uu.nl/groups/ST/Software/UU Parsing/, Aug. 2003.
 
32
 
33
P. Thiemann and M. Neubauer. Parameterized LR parsing. In G. Hedin and E. van Wyk, editors, Fourth Workshop on Language Descriptions, Tools and Applications, LDTA 2004, volume 110 of ENTCS, pages 115--132, Barcelona, Spain, Apr. 2004. Elsevier Science.
 
34
 
35
M. van den Brand and P. Klint. ASF+SDF meta-environment user manual. http://www.cwi.nl/projects/MetaEnv/meta/doc/manual/user-manual.html, July 2002.
 
36
 
37
 
38
Parsing with Sandstone's Visual Parse++. http://www.sand-stone.com/pwvp.ZIP, 2001.
 
39

Collaborative Colleagues:
Peter Thiemann: colleagues
Matthias Neubauer: colleagues