File: intro.yo

package info (click to toggle)
bisonc%2B%2B 6.09.02-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,984 kB
  • sloc: cpp: 9,375; ansic: 1,505; fortran: 1,134; makefile: 1,062; sh: 526; yacc: 84; lex: 60
file content (15 lines) | stat: -rw-r--r-- 1,124 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
    Usually it is not acceptable to have a program terminate on a parse
error. For example, a compiler should recover sufficiently to parse the rest
of the input file and check it for errors; a calculator should accept another
expression. Such errors violate the grammar for which the parser was
constructed and are called em(syntactic errors). Other types of errors are
called em(semantical errors): here the intended em(meaning) of the language is
not observed. For example, a division by too small a numeric constant (e.g.,
0) may be detected by the parser em(compile time). In general, what em(can) be
detected compile time should not left for the run-time to detect, and so the
parser should flag an error when it detects a division by a very small
numerical constant. B()'s parsers may detect both syntactic em(and)
semantical errors. Syntactical errors are detected automatically, while
the parser performs its parsing-job, semantical errors must explicitly be
defined when the grammar is constructed. The following sections cover the way
B()'s parser may handle syntactic errors and semantical errors, respectively.