diff --git a/bootstrap/pkg/core/eval.go b/bootstrap/pkg/core/eval.go index 0add4af..09c520f 100644 --- a/bootstrap/pkg/core/eval.go +++ b/bootstrap/pkg/core/eval.go @@ -37,7 +37,6 @@ func restOfExprs(es []IExpr, i int) []IExpr { // evaluation of a list it will evaluate all the elements and return the // evaluated list func evalForm(rt *Runtime, scope IScope, form IExpr) (IExpr, IError) { - switch form.GetType() { case ast.Nil: return form, nil diff --git a/bootstrap/pkg/core/function.go b/bootstrap/pkg/core/function.go index 4692cd2..e04a5fd 100644 --- a/bootstrap/pkg/core/function.go +++ b/bootstrap/pkg/core/function.go @@ -177,7 +177,6 @@ func MakeFnScope(rt *Runtime, parent IScope, bindings IColl, values IColl) (*Sco errors.E0002, fmt.Sprintf("expected '%d' arguments, got '%d'.", bindings.Count(), values.Count()), ) - } } @@ -200,7 +199,6 @@ func MakeFnScope(rt *Runtime, parent IScope, bindings IColl, values IColl) (*Sco // // for example: `(fn (x y &z) ...)` if binds[i].GetType() == ast.Symbol && binds[i].(*Symbol).IsRestable() { - if i != len(binds)-1 { return nil, MakeError(rt, binds[i], "The function argument with '&' has to be the last argument.") } diff --git a/bootstrap/pkg/core/keyword.go b/bootstrap/pkg/core/keyword.go index 2050af7..d006af0 100644 --- a/bootstrap/pkg/core/keyword.go +++ b/bootstrap/pkg/core/keyword.go @@ -67,7 +67,7 @@ package core // able to use the alias in a keyword. // // TODO: Cache the keywords in the runtime on the first eval so we -// done have to evaluate them over and over agian. It can be achieved +// done have to evaluate them over and over again. It can be achieved // by caching the `hash` value in the keyword itself and maintain a // hashmap in the runtime from hash codes to a pointer to the keyword. // But garbage collecting it would be an issue since Golang doesn't support diff --git a/bootstrap/pkg/core/list.go b/bootstrap/pkg/core/list.go index 73ec22e..5565db6 100644 --- a/bootstrap/pkg/core/list.go +++ b/bootstrap/pkg/core/list.go @@ -28,7 +28,7 @@ import ( /** WARNING: This List implementation may look simple and performant but since -we're using a slice here. But in fact it's not memory effecient at +we're using a slice here. But in fact it's not memory efficient at all. We need to rewrite this later to be a immutable and persistent link list of cons. */ diff --git a/bootstrap/pkg/core/macro.go b/bootstrap/pkg/core/macro.go index 59644aa..5c44cc5 100644 --- a/bootstrap/pkg/core/macro.go +++ b/bootstrap/pkg/core/macro.go @@ -66,7 +66,6 @@ func isMacroCall(rt *Runtime, scope IScope, form IExpr) (*Function, bool) { if macro.GetType() == ast.Fn && macro.(*Function).IsMacro() { return macro.(*Function), true } - } } return nil, false diff --git a/bootstrap/pkg/core/namespace.go b/bootstrap/pkg/core/namespace.go index df1ee66..c85703b 100644 --- a/bootstrap/pkg/core/namespace.go +++ b/bootstrap/pkg/core/namespace.go @@ -76,7 +76,7 @@ func (n *Namespace) SetExecutionScope(scope IScope) {} // DefineGlobal inserts the given expr `v` to the root scope of // `n`. The `public` parameter determines whether the public -// value is accessable publicly or not (in other namespaces). +// value is accessible publicly or not (in other namespaces). func (n *Namespace) DefineGlobal(k string, v IExpr, public bool) { n.rootScope.Insert(k, v, public) } diff --git a/bootstrap/pkg/core/numbers.go b/bootstrap/pkg/core/numbers.go index 7f15cd0..f4ab4fc 100644 --- a/bootstrap/pkg/core/numbers.go +++ b/bootstrap/pkg/core/numbers.go @@ -76,7 +76,6 @@ func (i Integer) Hash() uint32 { func (i Integer) GetExecutionScope() IScope { return i.scope - } func (i Integer) SetExecutionScope(scope IScope) { @@ -143,7 +142,6 @@ func (d Double) ToDebugStr() string { func (d Double) GetExecutionScope() IScope { return d.scope - } func (d Double) SetExecutionScope(scope IScope) { diff --git a/bootstrap/pkg/core/parser.go b/bootstrap/pkg/core/parser.go index b06ed1e..248bd54 100644 --- a/bootstrap/pkg/core/parser.go +++ b/bootstrap/pkg/core/parser.go @@ -53,7 +53,7 @@ var validChars = []rune{'!', '$', '%', '&', '*', '+', '-', '.', '~', '/', ':', ' type IParsable interface { // Reads the next character in the buffer with respect to skipWhitespace // parameter which basically jumps over whitespace and some conceptual - // equivilant of a whitespace like '\n' + // equivalent of a whitespace like '\n' next(skipWhitespace bool) *string // Similar to the `next` but it won't change the position in the buffer @@ -101,10 +101,8 @@ func (sp *StringParser) updateLineIndex(pos int) { } else { sp.lineIndex = append(sp.lineIndex, pos+1) } - } } - } // Returns the next character in the buffer @@ -137,7 +135,6 @@ func isSeparator(c *string) bool { } return false - } // Return the character of the buffer without consuming it @@ -389,7 +386,6 @@ func readSymbol(parser IParsable) (IExpr, IError) { parser.back() return readRawSymbol(parser) } - } return readRawSymbol(parser) } @@ -413,7 +409,6 @@ func readList(parser IParsable) (IExpr, IError) { return nil, err } list = append(list, val) - } } @@ -474,7 +469,7 @@ func readQuotedExpr(parser IParsable) (IExpr, IError) { // ~a => (unquote a) // ~@a => (unquote-splicing a) // Note: `unquote` and `unquote-splicing` are not global functions or special, they are bounded -// to quasiquoted experssions only. +// to quasiquoted expressions only. func readUnquotedExpr(parser IParsable) (IExpr, IError) { c := parser.peek(true) @@ -496,7 +491,6 @@ func readUnquotedExpr(parser IParsable) (IExpr, IError) { } else { expr, err = readExpr(parser) } - } else { sym, err = MakeSymbol(node, "unquote") if err != nil { @@ -599,7 +593,6 @@ loop: // } parser.back() return readSymbol(parser) - } //ParseToAST is the entry function to the reader/parser which @@ -609,7 +602,6 @@ loop: // It doesn't have anything to do with the concept of blocks // from other programming languages. func ParseToAST(ns string, input string) (*Block, IError) { - var ast Block parser := StringParser{ buffer: strings.Split(input, ""), diff --git a/bootstrap/pkg/core/printer.go b/bootstrap/pkg/core/printer.go index b1ac271..d0a1c75 100644 --- a/bootstrap/pkg/core/printer.go +++ b/bootstrap/pkg/core/printer.go @@ -98,7 +98,6 @@ func printError(rt *Runtime, err IError, stage int) { errTag := color.Red.Sprint(err.GetErrType().String()) fmt.Printf("%s: %s\nAt: %d to %d\n", errTag, err.String(), loc.GetStart(), loc.GetEnd()) - } func frameCaption(traces *TraceBack, frameIndex int) string { @@ -124,7 +123,6 @@ func frameCaption(traces *TraceBack, frameIndex int) string { source.NS, source.LineNumberFor(loc.GetStart()), ) - } func frameSource(traces *TraceBack, frameIndex int) string { @@ -157,7 +155,6 @@ func frameSource(traces *TraceBack, frameIndex int) string { } else { lines += "Builtin\n" } - } return lines @@ -182,7 +179,6 @@ func printErrorWithTraceBack(rt *Runtime, err IError) { if err.GetErrno() != errors.E0000 { fmt.Printf("For more information on this error try: `serene explain %s`\n", err.GetErrno()) } - } func PrintError(rt *Runtime, err IError) { diff --git a/bootstrap/pkg/core/runtime.go b/bootstrap/pkg/core/runtime.go index e2998b6..8333b57 100644 --- a/bootstrap/pkg/core/runtime.go +++ b/bootstrap/pkg/core/runtime.go @@ -125,7 +125,7 @@ func (r *Runtime) CreateNS(name string, source string, setAsCurrent bool) { // IsQQSimplificationEnabled returns a boolean value indicating whether // simplification of quasiquotation is enabled or not. If yes, we have -// to replace the quasiquote expanded forms with a simplier form to gain +// to replace the quasiquote expanded forms with a simpler form to gain // a better performance. func (r *Runtime) IsQQSimplificationEnabled() bool { // TODO: read the value of this flag from the arguments of serene @@ -133,7 +133,7 @@ func (r *Runtime) IsQQSimplificationEnabled() bool { return false } -// nsNameToPath converts a namespace name to the filesystem equivilant path +// nsNameToPath converts a namespace name to the filesystem equivalent path func nsNameToPath(ns string) string { replacer := strings.NewReplacer( ".", "/", diff --git a/bootstrap/pkg/core/sforms.go b/bootstrap/pkg/core/sforms.go index fcf1702..537feaa 100644 --- a/bootstrap/pkg/core/sforms.go +++ b/bootstrap/pkg/core/sforms.go @@ -63,7 +63,6 @@ func Def(rt *Runtime, scope IScope, args *List) (IExpr, IError) { // expressions in Serene `defmacro` DOES NOT evaluate its arguments. // That is what makes macros great func DefMacro(rt *Runtime, scope IScope, args *List) (IExpr, IError) { - // TODO: Add support for docstrings and meta if args.Count() < 2 { @@ -99,13 +98,11 @@ func DefMacro(rt *Runtime, scope IScope, args *List) (IExpr, IError) { ns.DefineGlobal(sym.GetName(), macro, true) return macro, nil - } // Fn defines a function inside the given scope `scope` with the given `args`. // `args` contains the argument list, docstring and body of the function. func Fn(rt *Runtime, scope IScope, args *List) (IExpr, IError) { - if args.Count() < 2 { return nil, MakeError(rt, args, "'fn' needs at least an arguments list") } @@ -156,5 +153,4 @@ func NSForm(rt *Runtime, scope IScope, args *List) (IExpr, IError) { return ns, nil // TODO: Handle the params like `require` and `meta` // params := args.Rest().Rest() - } diff --git a/bootstrap/pkg/core/types.go b/bootstrap/pkg/core/types.go index 8a199a1..4288c9d 100644 --- a/bootstrap/pkg/core/types.go +++ b/bootstrap/pkg/core/types.go @@ -75,7 +75,7 @@ type IExpr interface { } // TODO: Add helper functions to reach methods on Node.location. For example -// Node.location.DecStart() has to have a helper on the Node liek: +// Node.location.DecStart() has to have a helper on the Node like: // Node.DecStartLocation // Node struct is simply representing a Node in the AST which provides the @@ -95,7 +95,6 @@ type ExecutionScope struct { func (e *ExecutionScope) GetExecutionScope() IScope { return e.scope - } func (e *ExecutionScope) SetExecutionScope(scope IScope) {