34 lines
510 B
Go
34 lines
510 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"git.sharkk.net/Sharkk/Mako/parser"
|
|
)
|
|
|
|
func main() {
|
|
input := `
|
|
// This is a comment
|
|
name = "John"
|
|
age = 25
|
|
/* Block comment
|
|
Multiple lines */
|
|
result = age + 10
|
|
`
|
|
|
|
lexer := parser.NewLexer(input)
|
|
parser := parser.NewParser(lexer)
|
|
program := parser.ParseProgram()
|
|
|
|
if len(parser.Errors()) > 0 {
|
|
fmt.Println("Parse errors:")
|
|
for _, err := range parser.Errors() {
|
|
fmt.Printf(" %s\n", err)
|
|
}
|
|
return
|
|
}
|
|
|
|
fmt.Println("AST:")
|
|
fmt.Print(program.String())
|
|
}
|