GithubHelp home page GithubHelp logo

yupferris / butterball Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 961 KB

Just a little trip down memory lane :)

License: BSD 2-Clause "Simplified" License

BlitzBasic 46.02% Rust 53.97% Batchfile 0.01%

butterball's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

bbvault

butterball's Issues

Missing features

I'm only really concerned with the features needed to get the included blitz files up and running.

  • Function early-return
  • Function return values
  • Custom types
    • Basic variables/assignments etc
    • Array variables
    • Array fields
  • Images
  • Buffer abstraction
  • Audio? (not sure I want to go this far)
  • Mouse input (I believe rust_minifb might get the features we need; otherwise we could simulate some input)
  • Include support
  • Command line option for setting window scale

Optimization

While I don't think I want to go for a full-on native compiler for this little project, there are tons of things that can be done that will be pretty fun to do to speed up the interpreter that basically make it more JIT'y:

  • Implement indexed stack/frames to avoid dictionary lookups/manipulation during execution, particularly with variables (this should be the big one)
  • Resolve references to functions, un/bin ops, arrays, etc before execution
  • Consider transforming loop forms (For in particular) as a pre-pass instead of dynamically building new structures to evaluate
  • Use stack for impl arg's to avoid allocating vector's for each impl call
  • Precalc array dimension multipliers (these can be calculated when allocating the array, and should simplify indexing in the interpreter)
  • Flatten variable/array ref's into separate assignment/expression types in the IL (this should remove a lot of decision-making and error-checking in the interpreter)

General cleanup

This is probably going to be lots of little things, but in particular:

  • Refine the "context" and "program_state" concepts
  • Refine which state is internal to the context and interpreter
  • Fix variable/assignment type semantics (right now everything's basically weak-typed, even though the ast has type information)
  • Remove type coalescing in Value::as_integer/as_float (need to wait with this as it currently breaks some things)
  • Clarify function call/array element lookup ambiguity in parser/ast
  • Remove all unsafe code (right now there's some borrow checker trickery)
  • Remove "all arrays actually have extra elements in each dimension" hack (this is actually a necessary feature of the language that a lot of my old code depends on; see http://www.blitzbasic.com/bpdocs/command.php?name=Dim)
  • Fix argument types for impl func's
  • Refactor scopes so that push/pop are replaced with new/get RAII-style. Adding variables etc could also go through the current scope. (this isn't particularly relevant anymore, now that this only really happens in one place, is easy not to abuse, and will likely be superceded by a different stack mechanism soon)
  • Come up with a better name than ast::Node
  • Fix parser bugs where f.e. a file that ends with an expression will not parse completely (and remove the hacks in the source files to get around this)
  • Make End work properly again :)
  • Reduce argument list length in compiler (I'm actually a bit on the fence with this one, mainly because each fn becomes very explicit, and we've been able to eliminate all unsafe code by having more specific bindings)
  • Split up compiler.rs
  • Split up interpreter.rs
  • Split up impls and context into more specific API components (the Context struct is not a bad aggregate to keep around, but it should be composed of many smaller pieces of API state explicitly)
  • Implement proper type coercion in the compiler instead of filling out special case impl functions
  • Proper error handling instead of panic's (not likely to ever happen, frankly :) )
  • Clean up code in Graphics::draw_block (and probably others) that do some janky stuff to please the borrow checker when multiple possibly-mutable references to buffers are required at the same time by using splitmut

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.