Coder Social home page Coder Social logo

butter's People

Contributors

abrahampost avatar benknoble avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

benknoble

butter's Issues

Repl panics on EOF (hit CTRL-D)

 panic: runtime error: index out of range

goroutine 1 [running]:
main.(*Tokenizer).Advance(...)
        /Users/Knoble/go/src/github.com/abrahampost/Butter/tokenizer.go:413
main.(*Tokenizer).Tokenize(0xc00009ddb0, 0x0, 0x0, 0x0)
        /Users/Knoble/go/src/github.com/abrahampost/Butter/tokenizer.go:253 +0x1cb0
main.Run(0x0, 0x0, 0x1)
        /Users/Knoble/go/src/github.com/abrahampost/Butter/main.go:83 +0x99
main.RunPrompt()
        /Users/Knoble/go/src/github.com/abrahampost/Butter/main.go:73 +0x2a4
main.main()
        /Users/Knoble/go/src/github.com/abrahampost/Butter/main.go:38 +0xcd

REPL doesn't allow inputting block statements

Description:
As soon as a newline character is received, the REPL will attempt to interpret the inputted values. When there is a left brace that has yet to find a matching right brace, the REPL should continue accepting input. It will only attempt to run the input when everything has been closed, or enter has been pressed on an empty line.
Current behavior: REPL runs as soon as a newline is received
Desired Behavior: REPL won't attempt to run input if there is an unmatched left brace. Will override if there has been an empty line submitted.

Negative number support

Now only supports parsing positive numbers.

Current workaround: 0 - <number>

Yep, some oversight on my part.

Error message not correct

Sample run

$ ./Butter
Butterv0.1 (repl)
> string a := "a"
> a
a
> a := 5
RUNTIME_ERROR: Cannot assign value to int type

Reassignment issue?

> float a := 5
RUNTIME_ERROR: TypeError -> cannot assign int to float type
> a
RUNTIME_ERROR: Undefined variable: a
> int a := 5
> a
5
> a := 5.0
RUNTIME_ERROR: Cannot assign float to int type
> a := 6
RUNTIME_ERROR: Cannot assign int to float type
> a
6
>

Repl crashes when a Parse or Runtime error occurs

Description:
RuntimeError and ParseError both cause a panic-like printing of an error statement and then exit the program. This behavior is fine when running a file as it doesn't need to recover from a failure, however, the REPL should handle the error and then continue running.

Current Behavior: REPL crashes completely when any error occurs
Desired Behavior: REPL reports error and continues running

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.