Giter Site home page Giter Site logo

mjforth's People

Contributors

joedougherty avatar

Watchers

 avatar  avatar  avatar

mjforth's Issues

Differentiate between compile-time and run-time

The current execution model doesn't attempt to execute a word until the last possible moment. While this simplifies implementation, it doesn't allow for support of the IMMEDIATE word or the [] syntax (as in [char] * emit ; ).

In order to support this, I'll need to modify define_word to optionally interpret definitions on-the-fly.

Consider Variable class

[https://www.forth.com/starting-forth/8-variables-constants-arrays/#For_People_Who_Dont_Like_Guessing_How_It_Works -- A Closer Look at Variables]

Consider writing a Variable class - it its a variable, instantiate a new Variable instance (assume it has a .value attribute) and keep all entries in the globally-accessible Dictionary.

Refactor `show_definition()`

def show_definition(word):
    if word not in Words:
        print(("{} has not been defined!".format(word)))
        return False

    if isinstance(Words[word]["doc"], list):
        print(("({})".format(" ".join(Words[word]["doc"]))))
    if isinstance(Words[word]["doc"], str):
        print(("({})".format(Words[word]["doc"])))
    if callable(Words[word]["fn"]):
        print(("  " + Words[word]["fn"].__name__ + " [built-in]"))
    if isinstance(Words[word]["fn"], list):
        print(("  " + " ".join([str(i) for i in Words[word]["fn"]])))
        print(
            (
                " : {} ( {} ) {} ; ".format(
                    word,
                    " ".join(Words[word]["doc"]),
                    " ".join([str(i) for i in Words[word]["fn"]]),
                )
            )
        )

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.