-
Notifications
You must be signed in to change notification settings - Fork 1
Overview
Hadron67 edited this page Feb 22, 2018
·
1 revision
Grammar file of tscc-compiler is similiar to that of yacc. Structure of the file is
[options] %% [grammar rules] %% [epilogue]
The options contains miscellaneous definations, such as token definations, token associativity, output language, and most importantly, the lexical rules.
Format of the grammar rules is similiar to yacc.
The epilogue is code to be copied to the end of the generated parser source without being modified.
- Identifiers are the same as those in ES5.
- Strings are bounded by
"
or'
, it may contains ordinary characters and escape characters start with\
, like\n
,\r
,\t
,\b
,\f
, plus character code like\xff50
or\uff30
, where x and u are the same, and the code could be either ascii code or unicode.
comments in grammar files are similiar to that of C. There are three types of comment:
/* block comment */
// line comment
# line comment begins with '#'