Giter Site home page Giter Site logo

symbolic-stack-machines's People

Contributors

wilfredta avatar williamberman 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

symbolic-stack-machines's Issues

Make Extension Environment Generic

In a previous version of symbolic-stack-machines (SSM), each modular component (memory, stack, etc) were all generic over Instruction. The idea was to use Rust's type system to configure the machine's behavior. This turned out to be detrimental to the library's ease of use & ergonomics more specifically.

While climbing out of the so-called "generics-hell", we realized that most of the generics in various components were due to being generic over the type of values stored in the stack, memory, storage, etc. Thus, we created a universal value type that is lazily evaluated; the universal value is actually an AST.

We also introduced a Configuration object for each modular component (StackConfig, MemConfig, etc). These config objects are meant to receive hooks which can be passed to the universal value's AST interpreter. This allows us to treat the universal value in Rust's type system as a single type (thereby drastically simplifying the library's API), while also allowing various components to customize the semantics of that type and specialize it to whichever type is relevant for that component. In other words, it gives us polymorphism across different components as well as polymorphism across different values within a particular component, since the hooks passed to the universal value's interpreter can conditionally evaluate the value as a different type based on the component's state.

The only component that does in fact need to be generic is the ExtEnv. This is because it is meant to be a catch all extension mechanism for implementing symbolic machines with more components, as well as those with bespoke features (e.g., the concept of "gas" in the EVM). Notably, the ExtEnv can also be leveraged to construct register-based machines. The crucial difference between the extension environment component and other components is that it does not have a predefined structure. While other components are well defined though generic over the relevant values on which they operate (a memory is treated as a flat array with some index set and value set; a stack is an abstract data type with API to push, pop, and peek), the ExtEnv has no predefined API nor structural constraints. Thus, we should re-introduce generics to the definition of this component.

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.