32 lines
789 B
Go
32 lines
789 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var runCmd = &cobra.Command{
|
|
Use: "run [expression]",
|
|
Short: "Evaluate a lambda calculus expression",
|
|
Long: `Evaluate a lambda calculus expression and print the result.
|
|
|
|
The expression can be provided as an argument, read from a file with --file,
|
|
or piped through stdin.`,
|
|
Example: ` lambda run "\x.x"
|
|
echo "\x.x" | lambda run
|
|
lambda run --file program.sch
|
|
lambda run --file program.sch --engine krivine`,
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
fmt.Fprintln(os.Stderr, "not implemented")
|
|
os.Exit(1)
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
runCmd.Flags().StringP("file", "f", "", "read expression from file")
|
|
runCmd.Flags().StringP("engine", "e", "normal", "evaluation engine to use")
|
|
rootCmd.AddCommand(runCmd)
|
|
}
|