📄 overview.html
字号:
<HTML><HEAD><TITLE>The ACCENT Compiler Compiler: Overview</TITLE></HEAD><BODY bgcolor="white"><TABLE cellspacing=20> <TR> <TD valign="top"> <img src="logo.gif"> </TD> <TD valign="bottom" align="left"> <a href="index.html">The Accent Compiler Compiler</a> <h1>Overview</h1> </TD> </TR> <TR> <TD align="right" valign="top"> <!-- MENU --> <font face="helvetica"> <a href="index.html">Accent</a><br> Overview<br> <a href="tutorial.html">Tutorial</a><br> <a href="language.html">Language</a><br> <a href="installation.html">Installation</a><br> <a href="usage.html">Usage</a><br> <a href="lex.html">Lex</a><br> <a href="algorithms.html">Algorithms</a><br> <a href="distribution.html">Distribution</a><br> </font> </TD> <TD valign="top"> <!--- begin main content --><h3>Compiler Compilers</h3>Compiler compilers like Yacc or Accentare used to generate language processors (such as compilers,translators, or interpreters) from high-level descriptions.You specify the grammar of your language,and the compiler compiler creates a program that processesinput text written in your language.This program hierarchically decomposes the input text into phrases.For each kind of phrase you can attach semantic actions to your grammarwhich are elaborated when the corresponding phrase is processed.<p>Technology from classical compiler construction becomes more and moreimportant in the fields of domain specific languages, document processing,and automatic software generation.Authors working in these areas are experts in their field, but not necessaryexperts in the field of parsing technology.Whereas most programmers are familiar with the notionof grammars, it requires special education to write a grammar in such a waythat it fulfills the requirements of a specific parsing approach.<p>The Accent compiler compiler does not impose any restrictions onthe user's specification.It can process the entire class of context-free grammars.So one can provide the "natural" grammar for a language and concentrateon the semantics.<h3>Yacc and Other Compiler Compilers</h3>Compiler compilers like Yacc are based on the LALR approach.This results in very efficient parsers and covers a large rangeof grammars. But unfortunately a user has to be familiar withthis technique when his or her grammar does not fulfillits restrictions.When confronted with "shift/reduce" or "reduce/reduce" conflicts(that indicate a violation of the LALR property) the userhas to adapt the grammar. This often requires an insight into the workingof the parser and in many cases complicates the description ofthe language.<p>Other systems use LL parsing. Conflicts that are reported by anLL generator have a more intuitive interpretation than LALR conflicts.On the other hand, these systems are even more restrictive. For example,the natural grammar for arithmetic expressions cannot be usedbecause the approach cannot deal with left-recursive rules.<p>In both cases the design of the grammar is influenced by theparser implementation technique.This can be avoided with Accent.<h3>The Accent Compiler Compiler</h3>Accent does not rely on specific subclasses of context-free grammars.<p>Accent can be used like Yacc. It also cooperates with Lex.The specification language of Accent is similar to that of Yacc,but Accent uses symbolic names for attributes instead of Yacc's error-pronenumbers. Accent supports both, inherited and synthezised attributes.It allows you to write your grammar in the Extended-Backus-Naur-Form,in which you can specify repetition, choices, and optional parts withoutintroducing special rules for this purpose.In Accent, semantic actions can be inserted anywhere, there are no restrictionscaused by the parser implementation.<p>Accent even allows ambiguous grammars(grammars that can structure the same input in different ways).But if there is more than one way to parse the input,the grammar must specify which to select.When using an LALR or LL generator,ambiguous grammars result in conflicts during parser generation.In certain cases the user can select a specific choiceby stating how to deal with such conflicts.This again requires knowledge of the implementation technique.<p>For Accent we have developed an annotation framework to resolve ambiguities.It is on the abstract level of grammars and does not reflectthe parsing algorithm.Moreover, this calculus is complete in the sense thatit can handle each ambiguity in any grammar.<h3>"What Tool Should I Use ?"</h3>Accent grammars are much easier to write than Yacc grammars.But the generality has its price: Accent parsers require significantlymore resources than parsers generated by Yacc.Nevertheless Accent is an alternative for a wide range of applications.An Accent parser for Java can process thousands of lines in a few seconds.<p>If you don't have problems with LALR conflicts useYacc or Bison.If you are developing a compiler that will be used by many peoplemany times a day(or if you have to process very large data on very old computers)you should invest time to adapt your grammar for Yacc.<p>You may also consider advanced LL tools such asANTLR orPRECC.<p>Accent may be the choice if you want to create a language processorfor a specific problem in short time. <!--- end main content --> <br> <br> <font face="helvetica" size="1"> <a href="http://accent.compilertools.net">accent.compilertools.net</a> </font> </TD> </TR></TABLE></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -