Add a new interpreter option (-i debruijn) that uses De Bruijn indices for variable representation, eliminating the need for variable renaming during substitution. - Add -i flag to select interpreter (lambda or debruijn) - Create debruijn package with Expression types (Variable with index, Abstraction without parameter, Application) - Implement shift and substitute operations for De Bruijn indices - Add conversion functions between lambda and De Bruijn representations - Update CLI to support switching between interpreters - Add De Bruijn tests to verify all samples pass Closes #26
22 lines
822 B
Go
22 lines
822 B
Go
// Package "config" parses ad handles the user settings given to the program.
|
|
package config
|
|
|
|
// Interpreter specifies the reduction engine to use.
|
|
type Interpreter string
|
|
|
|
const (
|
|
LambdaInterpreter Interpreter = "lambda"
|
|
DeBruijnInterpreter Interpreter = "debruijn"
|
|
)
|
|
|
|
// Configuration settings for the program.
|
|
type Config struct {
|
|
Source Source // The source code given to the program.
|
|
Destination Destination // The destination for the final result.
|
|
Verbose bool // Whether or not to print debug logs.
|
|
Explanation bool // Whether or not to print an explanation of the reduction.
|
|
Profile string // If not nil, print a CPU profile during execution.
|
|
Statistics bool // Whether or not to print statistics.
|
|
Interpreter Interpreter // The interpreter engine to use.
|
|
}
|