Skip to content

The Asteroid REPL#140

Merged
olwmc merged 11 commits intodev-1.0.0from
repl-test
Feb 22, 2022
Merged

The Asteroid REPL#140
olwmc merged 11 commits intodev-1.0.0from
repl-test

Conversation

@olwmc
Copy link
Copy Markdown
Collaborator

@olwmc olwmc commented Feb 22, 2022

This PR implements a REPL for asteroid. The REPL is now the default run option for asteroid. (i.e. running asteroid runs the REPL).

The REPL has two basic functions:

  • Basic Read-Eval-Print-Loop functionality
  • Multi-line prompting/support

This PR also adds a new error class, ExpectationError. Technically a subset of all SyntaxError's, this type of exception is raised when the parser/lexer expected a token but did not find it.

If possible, try to break this PR! I'm wondering if this scheme is robust enough.

@olwmc
Copy link
Copy Markdown
Collaborator Author

olwmc commented Feb 22, 2022

Also included in the REPL is being able to CTRL+C out of partially completed statements, I.e.:

@olwmc olwmc linked an issue Feb 22, 2022 that may be closed by this pull request
Copy link
Copy Markdown
Collaborator

@lutzhamel lutzhamel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Oliver, quick question, does the introduction of the ExpectationError exception change the behavior of the -e flag?

@olwmc
Copy link
Copy Markdown
Collaborator Author

olwmc commented Feb 22, 2022

Nope, the -e flag works the same. You can think of ExpectationError as a drop-in replacement for SyntaxError in that scenario.

Copy link
Copy Markdown
Collaborator

@lutzhamel lutzhamel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! This will help me a lot when I teach 301 using Asteroid!

@olwmc olwmc merged commit 0018061 into dev-1.0.0 Feb 22, 2022
@olwmc olwmc deleted the repl-test branch February 24, 2022 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

REPL feature

2 participants