Git Product home page Git Product logo

hofstadter's People

Contributors

alexanderkrneta avatar azhenley avatar gcrois avatar jwg4 avatar lukepmccombs avatar mmathur20 avatar thalomir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hofstadter's Issues

Wrong Symbol for Console IO

hofstadter/hofstadter.py

Lines 38 to 41 in 1c30c61

# Stdin/stdout.
if self.text[self.index] == '#':
self.index += 1
return ('#', '#')

In the above lines from the interpreter, the symbol for console io is denoted by #. Either the documentation should be updated to reflect that or the interpreter should be updated to be consistent with the documentation.

Conditional Error (hofstadter.py:76)

Error:

Traceback (most recent call last):
  File "/home/cade/programs/hofstadter/hofstadter.py", line 221, in <module>
    evaluator = Evaluator([Line(x) for x in rawlines])
  File "/home/cade/programs/hofstadter/hofstadter.py", line 221, in <listcomp>
    evaluator = Evaluator([Line(x) for x in rawlines])
  File "/home/cade/programs/hofstadter/hofstadter.py", line 17, in __init__
    self.tokenize()
  File "/home/cade/programs/hofstadter/hofstadter.py", line 23, in tokenize
    t = self.nextToken()
  File "/home/cade/programs/hofstadter/hofstadter.py", line 76, in nextToken
    while not self.text[self.index].isspace() or escaped and self.index < length:
IndexError: string index out of range

https://github.com/AZHenley/hofstadter/blob/main/hofstadter.py#L76 has the conditional checks out of order, it change from:

            while not self.text[self.index].isspace() or escaped and self.index < length:

to:

            while self.index < length and not self.text[self.index].isspace() or escaped:

Add __name__ check to allow for import

Most useful programs written in hofstadter will likely need some setup and cleanup utilities -- adding a __name__ check would allow for programmers to 'elegantly' import hofstadter into a python script which encompasses setup, execution, and cleanup.

stdin/stdout character inconsistency

In the documentation, it is stated that ; represents the Console IO character. In the source code, hofstader.py lines 39-41 tokenize # as the "stdin/stdout" token. As such, current evaluation computes ; as a filename. Either the documentation should be updated to reflect that # is the appropriate operator, or the code should be changed to evaluate ; as the console operator.

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.