Running T0 basically consists in looking at exit values:
print ("Hello, World!\n")
File 1: simple.tig
$ tc simple.tig Example 2: tc simple.tig
The following example demonstrates the scanner and parser tracing. The glyphs “error-->” and “=>” are typographic conventions to specify respectively the standard error stream and the exit status. They are not part of the output per se.
$ SCAN=1 PARSE=1 tc simple.tig error-->Starting parse error-->Entering state 0 error-->Reading a token: --(end of buffer or a NUL) error-->--accepting rule at line 99 ("print") error-->Next token is 259 ("identifier" simple.tig:1.0-4: print) error-->Shifting token 259 ("identifier"), Entering state 2 error-->Reading a token: --accepting rule at line 52 (" ") error-->--accepting rule at line 58 ("(") error-->Next token is 264 ("(" simple.tig:1.6) error-->Reducing via rule 81 (line 403), "identifier" -> funid error-->state stack now 0 error-->Entering state 18 error-->Next token is 264 ("(" simple.tig:1.6) error-->Shifting token 264 ("("), Entering state 59 error-->Reading a token: --accepting rule at line 103 (""") error-->--accepting rule at line 172 ("Hello, World!") error-->--accepting rule at line 159 ("\n") error-->--accepting rule at line 134 (""") error-->Next token is 258 ("string" simple.tig:1.7-23: Hello, World! error-->) error-->Shifting token 258 ("string"), Entering state 1 error-->Reducing via rule 19 (line 213), "string" -> exp error-->state stack now 59 18 0 error-->Entering state 102 error-->Reading a token: --accepting rule at line 59 (")") error-->Next token is 265 (")" simple.tig:1.24) error-->Reducing via rule 46 (line 284), exp -> args.1 error-->state stack now 59 18 0 error-->Entering state 104 error-->Next token is 265 (")" simple.tig:1.24) error-->Reducing via rule 45 (line 279), args.1 -> args error-->state stack now 59 18 0 error-->Entering state 103 error-->Next token is 265 (")" simple.tig:1.24) error-->Shifting token 265 (")"), Entering state 123 error-->Reducing via rule 20 (line 216), funid "(" args ")" -> exp error-->state stack now 0 error-->Entering state 13 error-->Reading a token: --(end of buffer or a NUL) error-->--accepting rule at line 53 (" error-->") error-->--(end of buffer or a NUL) error-->--EOF (start condition 0) error-->Now at end of input. error-->Reducing via rule 1 (line 163), exp -> program error-->state stack now 0 error-->Entering state 12 error-->Now at end of input. Example 3: SCAN=1 PARSE=1 tc simple.tig
A lexical error must be properly diagnosed and reported. The following (generated) examples display the location: this is not required for T0; nevertheless, an error message on the standard error output is required.
"\z does not exist."
File 4: back-zee.tig
$ tc back-zee.tig error-->back-zee.tig:1.0-2: unrecognized escape: \z =>2 Example 5: tc back-zee.tig
Similarly for syntactical errors.
a++
File 6: postinc.tig
$ tc postinc.tig error-->postinc.tig:1.2: syntax error, unexpected "+" error-->Parsing Failed =>3 Example 7: tc postinc.tig