Abstract

The problem of the semantic definition of a programming language has been approached by Knuth by means of 'attribute grammar'.' They consist of a syntactic part, which is typically a context-free grammar, and of a semantic part, made up of a set of attributes associated to each symbol and of a set of semantic functions used to evaluate the attributes' values while constructing the syntactic tree. Attribute grammars have been widely investigated,~ and rules have been given to evaluate attributes from left to right and to build compilers which use semantic knowledge to overcome syntactic ambiguities.'' A related concept is that of 'affix grammar', for which parsing methods have been defined. The main problem while parsing a sentence by means of an attribute grammar is to perform a suitable error detection and recovery. In Ref. l l a parsing algorithm is presented, which allows the detection of a semantic error as soon as it is required to guarantee that the previously parsed substring of input symbols is a viable prefix. A recovery procedure based on this method can operate only on the new input symbols, exactly as it happens with all the classical syntactic recovery procedures defined for LL(fc) or LR(fc) grammars. Such a recovery algorithm is presented in the third section of this paper, after a short discussion of the theoretical preliminaries, which is included here in order to make the paper self-contained. The last section is devoted to the detailed analysis of two examples of recovery from syntactic and semantic error.

Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.