feat: added optional profiling

This commit is contained in:
2025-12-28 22:52:10 -05:00
parent a4c049c0ff
commit e9dc3fe171
8 changed files with 124 additions and 77 deletions

View File

@@ -1,37 +0,0 @@
package cli
import (
"flag"
"fmt"
)
// Arguments given to program.
type Options struct {
// The source code given to the program.
Input string
// Whether or not to print debug logs.
Verbose bool
// Whether or not to print an explanation of the reduction.
Explanation bool
}
// Extract the program configuration from the command-line arguments.
func ParseOptions() (*Options, error) {
// Parse flags.
verbose := flag.Bool("v", false, "Verbosity. If set, the program will print logs.")
explanation := flag.Bool("x", false, "Explanation. Whether or not to show all reduction steps.")
flag.Parse()
// Parse non-flag arguments.
if flag.NArg() == 0 {
return nil, fmt.Errorf("no input given")
} else if flag.NArg() > 1 {
return nil, fmt.Errorf("more than 1 command-line argument")
}
return &Options{
Input: flag.Arg(0),
Verbose: *verbose,
Explanation: *explanation,
}, nil
}