feat: parser
This commit is contained in:
@@ -6,19 +6,24 @@ import (
|
||||
"os"
|
||||
|
||||
"git.maximhutz.com/max/lambda/pkg/cli"
|
||||
"git.maximhutz.com/max/lambda/pkg/parser"
|
||||
"git.maximhutz.com/max/lambda/pkg/tokenizer"
|
||||
)
|
||||
|
||||
func main() {
|
||||
slog.Info("Using program arguments.", "args", os.Args)
|
||||
|
||||
options, err := cli.ParseOptions(os.Args[1:])
|
||||
cli.HandleError(err)
|
||||
|
||||
slog.Info("Parsed CLI options.", "options", options)
|
||||
|
||||
tokens, fails := tokenizer.GetTokens([]rune(options.Input))
|
||||
if len(fails) > 0 {
|
||||
cli.HandleError(errors.Join(fails...))
|
||||
}
|
||||
|
||||
slog.Info("Parsed tokens.", "tokens", tokens)
|
||||
|
||||
ast, err := parser.GetTree(tokens)
|
||||
cli.HandleError(err)
|
||||
slog.Info("Parsed syntax tree.", "tree", ast)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user