aboutsummaryrefslogtreecommitdiff
path: root/compiler (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Change the lexical specs of regexp and define concrete syntax error valuesRyo Nihei2021-04-175-425/+568
| | | | | * Make the lexer treat ']' as an ordinary character in default mode * Define values of the syntax error type that represents error information concretely
* Increase the maximum number of symbol positions per patternRyo Nihei2021-04-125-29/+139
| | | | | This commit increases the maximum number of symbol positions per pattern to 2^15 (= 32,768). When the limit is exceeded, the parse method returns an error.
* Fix grammar the parser acceptsRyo Nihei2021-04-116-99/+1193
| | | | | * Add cases test the parse method. * Fix the parser to pass the cases.
* Add logging to compile commandRyo Nihei2021-04-083-47/+108
| | | | | compile command writes logs out to the maleeni-compile.log file. When you use compiler.Compile(), you can choose whether the lexer writes logs or not.
* Add logical inverse expressionRyo Nihei2021-04-016-34/+766
| | | | [^a-z] matches any character that is not in the range a-z.
* Pass values in error type to panic()Ryo Nihei2021-03-071-2/+2
| | | | Because parser.parse() expects that recover() returns a value in error type, apply this change.
* RefactoringRyo Nihei2021-02-255-502/+351
| | | | | | * Remove token field from symbolNode * Simplify notation of nested nodes * Simplify arguments of newSymbolNode()
* Add range expressionRyo Nihei2021-02-243-8/+717
| | | | [a-z] matches any one character from a to z. The order of the characters depends on Unicode code points.
* Add + and ? operatorsRyo Nihei2021-02-205-16/+82
| | | | | * a+ matches 'a' one or more times. This is equivalent to aa*. * a? matches 'a' zero or one time.
* Fix computation of last positionsRyo Nihei2021-02-172-0/+122
|
* Add types of lexical specificationsRyo Nihei2021-02-162-11/+27
| | | | APIs of compiler and driver packages use these types. Because CompiledLexSpec struct a lexer takes has kind names of lexical specification entries, the lexer sets them to tokens.
* Add bracket expression matching specified characterRyo Nihei2021-02-143-9/+109
| | | | The bracket expression matches any single character specified in it. In the bracket expression, the special characters like ., *, and so on are also handled as normal characters.
* Add dot symbol matching any single characterRyo Nihei2021-02-146-20/+158
| | | | | | | | | The dot symbol matches any single character. When the dot symbol appears, the parser generates an AST matching all of the well-formed UTF-8 byte sequences. Refelences: * https://www.unicode.org/versions/Unicode13.0.0/ch03.pdf#G7404 * Table 3-6. UTF-8 Bit Distribution * Table 3-7. Well-Formed UTF-8 Byte Sequences
* Add compilerRyo Nihei2021-02-148-0/+1265
The compiler takes a lexical specification expressed by regular expressions and generates a DFA accepting the tokens. Operators that you can use in the regular expressions are concatenation, alternation, repeat, and grouping.