fix: unbound substitutions, explanation tag
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"git.maximhutz.com/max/lambda/internal/cli"
|
||||
"git.maximhutz.com/max/lambda/pkg/lambda"
|
||||
@@ -35,9 +36,21 @@ func main() {
|
||||
cli.HandleError(err)
|
||||
logger.Info("Parsed syntax tree.", "tree", lambda.Stringify(expression))
|
||||
|
||||
for lambda.ReduceOnce(&expression) {
|
||||
logger.Info("Reduction.", "tree", lambda.Stringify(expression))
|
||||
start := time.Now()
|
||||
|
||||
if options.Explanation {
|
||||
fmt.Println(lambda.Stringify(expression))
|
||||
}
|
||||
|
||||
for lambda.ReduceOnce(&expression) {
|
||||
logger.Info("Reduction.", "tree", lambda.Stringify(expression))
|
||||
if options.Explanation {
|
||||
fmt.Println(" =", lambda.Stringify(expression))
|
||||
}
|
||||
}
|
||||
|
||||
elapsed := time.Since(start).Milliseconds()
|
||||
|
||||
fmt.Println(lambda.Stringify(expression))
|
||||
fmt.Fprintln(os.Stderr, "Time Spent:", elapsed, "ms")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user