After Read Mono

xiaoxiao2021-03-06  57

use the token () method from the cs-tokenizer.cs, i can recognize how the csharp compiler to work follow this, that is the most important part of the driver:. static void tokenize_file (SourceFile file) firstly, the mcs used some expression to replace the general parser which is got from book (like as "if (is_identifier || is_identifier_numeric) {...}");. Each time a token is returned, the location for the token is recorded into the `Location ' property, that can be accessed by the parser. The parser retrieves the Location properties as it builds its internal representation to allow the semantic analysis phase to produce error messages that can pin point the location of the problem. Some tokens have values ​​associated with it, for example when the tokenizer encounters a string, it will return a LITERAL_STRING token, and the actual string parsed will be available in the `Value 'property of the tokenizer. The same mechanism is used to return integers and floating point numbers. //

转载请注明原文地址:https://www.9cbs.com/read-84249.html

New Post(0)