Handling the Complexities of a Real-World Language: A Harmonia Language Module for C

Stephen McCamant

EECS Department
University of California, Berkeley
Technical Report No. UCB/CSD-02-1192
August 2002

http://www2.eecs.berkeley.edu/Pubs/TechRpts/2002/CSD-02-1192.pdf

The syntax of popular programming languages often includes features that don't conform to the simplest models of program translation. Though designed to be easy for conventional compilers to handle, these features can cause trouble for language analysis in other environments. In implementing support for the C language within the Harmonia incremental framework, we've needed unconventional approaches to deal with the language's quirks. Closely following the language specification, we describe how a flex-based lexer, an ambiguous context-free grammar, and an object-oriented syntax-tree based analysis can be built to function well in a text editor or other interactive environment. By resolving syntactic ambiguities during name resolution, we collect accurate semantic information about identifiers and types, providing the basis for enhanced services in our augmented version of XEmacs.


BibTeX citation:

@techreport{McCamant:CSD-02-1192,
    Author = {McCamant, Stephen},
    Title = {Handling the Complexities of a Real-World Language: A Harmonia Language Module for C},
    Institution = {EECS Department, University of California, Berkeley},
    Year = {2002},
    Month = {Aug},
    URL = {http://www2.eecs.berkeley.edu/Pubs/TechRpts/2002/5244.html},
    Number = {UCB/CSD-02-1192},
    Abstract = {The syntax of popular programming languages often includes features that don't conform to the simplest models of program translation. Though designed to be easy for conventional compilers to handle, these features can cause trouble for language analysis in other environments. In implementing support for the C language within the Harmonia incremental framework, we've needed unconventional approaches to deal with the language's quirks.  Closely following the language specification, we describe how a flex-based lexer, an ambiguous context-free grammar, and an object-oriented syntax-tree based analysis can be built to function well in a text editor or other interactive environment. By resolving syntactic ambiguities during name resolution, we collect accurate semantic information about identifiers and types, providing the basis for enhanced services in our augmented version of XEmacs.}
}

EndNote citation:

%0 Report
%A McCamant, Stephen
%T Handling the Complexities of a Real-World Language: A Harmonia Language Module for C
%I EECS Department, University of California, Berkeley
%D 2002
%@ UCB/CSD-02-1192
%U http://www2.eecs.berkeley.edu/Pubs/TechRpts/2002/5244.html
%F McCamant:CSD-02-1192