feat: stuff
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
|
||||
"git.maximhutz.com/max/lambda/internal/cli"
|
||||
"git.maximhutz.com/max/lambda/internal/config"
|
||||
"git.maximhutz.com/max/lambda/pkg/lambda"
|
||||
"git.maximhutz.com/max/lambda/pkg/saccharine"
|
||||
)
|
||||
|
||||
@@ -31,24 +30,24 @@ func main() {
|
||||
// Turn tokens into syntax tree.
|
||||
expression, err := saccharine.GetTree(tokens)
|
||||
cli.HandleError(err)
|
||||
logger.Info("Parsed syntax tree.", "tree", lambda.Stringify(expression))
|
||||
logger.Info("Parsed syntax tree.", "tree", saccharine.Stringify(expression))
|
||||
|
||||
// Reduce expression.
|
||||
start := time.Now()
|
||||
|
||||
if options.Explanation {
|
||||
fmt.Println(lambda.Stringify(expression))
|
||||
fmt.Println(saccharine.Stringify(expression))
|
||||
}
|
||||
|
||||
for lambda.ReduceOnce(&expression) {
|
||||
logger.Info("Reduction.", "tree", lambda.Stringify(expression))
|
||||
if options.Explanation {
|
||||
fmt.Println(" =", lambda.Stringify(expression))
|
||||
}
|
||||
}
|
||||
// for lambda.ReduceOnce(&expression) {
|
||||
// logger.Info("Reduction.", "tree", saccharine.Stringify(expression))
|
||||
// if options.Explanation {
|
||||
// fmt.Println(" =", saccharine.Stringify(expression))
|
||||
// }
|
||||
// }
|
||||
|
||||
elapsed := time.Since(start).Milliseconds()
|
||||
|
||||
fmt.Println(lambda.Stringify(expression))
|
||||
fmt.Println(saccharine.Stringify(expression))
|
||||
fmt.Fprintln(os.Stderr, "Time Spent:", elapsed, "ms")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user