parser (still doesn't work)

This commit is contained in:
2024-08-11 13:53:53 +02:00
parent c502131aa7
commit 154e9597ae
5 changed files with 96 additions and 25 deletions
+3 -4
View File
@@ -7,11 +7,10 @@ import (
)
func main() {
code := "int x"
ast, state, err := parser.Parse(code, parser.RULE_SET)
code := "int x;"
ast, err := parser.ParseString(code)
if err != nil {
fmt.Printf("SyntaxErr at %d:%d: %s\n", state.Line, state.Column, err)
return
fmt.Printf("SyntaxErr: %s\n", err)
}
for i := 0; i < len(ast); i++ {
fmt.Printf("%s\n", ast[i])