Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signed Numbers Not Supported for Numeric Input #22

Open
sy-python opened this issue Dec 1, 2024 · 3 comments
Open

Signed Numbers Not Supported for Numeric Input #22

sy-python opened this issue Dec 1, 2024 · 3 comments

Comments

@sy-python
Copy link

sy-python commented Dec 1, 2024

Description: Trying to parse numeric input when the number has a sign (e.g. -5, +6) leads to ShakespeareRuntimeError

Sample Play:

The Folly Of The Writer, a tragedy in one act.

Romeo, Determined to expose every single mistake.  
Juliet, His ever-faithful companion.

Act I: The Error Begins.  
Scene I: A Sign Of Disaster.

[Enter Romeo and Juliet]

Romeo: Listen to your heart. Open your heart.

Expected Behaviour:
The program should correctly interpret signed numbers as valid input. When running the sample play with the following inputs, the expected outputs should be:

Input: 23
Output: 23

Input: -6
Output: -6

Input: +9
Output: 9

Actual Behaviour:
The program handles unsigned numbers correctly, but fails when parsing signed numbers, raising a ShakespeareRuntimeError. The following happens:

Input: 23
Output: 23

Input: -6
Error Raised: ShakespeareRuntimeError: No numeric input was given.

Input: +9
Error Raised: ShakespeareRuntimeError: No numeric input was given.

@zmbc
Copy link
Owner

zmbc commented Dec 2, 2024

This is a wonderful bug report! I'm wondering, is this behavior described in the Shakespeare specification, or is this behavior you've seen in other implementations (if so, which ones)?

@sy-python
Copy link
Author

The SPL2C compiler that was originally posted on the sourceforge page and is still accessible on TryItOnline.

@zmbc
Copy link
Owner

zmbc commented Dec 6, 2024

Ok, that's good enough for me! 🙂

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

No branches or pull requests

2 participants