The invention discloses an ST language
extension method,
system and device fusing syntactic
sugar and a medium, and relates to the technical field of compiling language extension, the method comprises the following steps: S1, reading an ST source file using extended syntactic characteristics, and generating a lexical symbol
stream; s2, reading the lexical symbol
stream, and generating an extended
syntax tree based on extended ST
syntax; s3, traversing the extended
syntax tree, and updating the type information of each node of the extended syntax tree; s4, based on a preset code detection rule, performing validity detection on the extended syntax tree; traversing the extended syntax tree again, and
rewriting the code using the extended syntax into a standard code; and S6, outputting the codes which are written by using the standard codes and have the same
semantics. According to the method, a high-order iteration method is provided for a set type by referring to
Java grammar and
sugar grammar rules and an implementation mechanism, iteration details are packaged, the program development efficiency can be improved, and the problem of
border crossing access caused by array traversal can be fundamentally avoided.