Permalink
Commits on Jan 15, 2019
  1. Add overloads of 0x37-a not, and, or for booleans

    swordglowsblue committed Jan 15, 2019
  2. Refactor popType and peekType, add checkType

    swordglowsblue committed Jan 15, 2019
    - No more internal assignment
    - Easy checkType without using peekType + rescue
Commits on Jan 14, 2019
Commits on Jan 12, 2019
  1. Refactor for better/more idiomatic testing

    swordglowsblue committed Jan 12, 2019
    - Sherwood is now a class rather than a module
      - @@stdin is now @stdin, and can be passed in the constructor (default: STDIN)
      - @@stdout is now @stdout, and can be passed in the constructor (default: STDOUT)
      - @@stderr no longer exists
      - There are no longer getter/setter methods for @stdin/@stdout
      - SW_ type aliases have been moved to their own module, Sherwood::Types
    - Added utility methods to Int
      - Int#bytesize returns the size in bytes of the integer (by type, not by actual space requirement)
      - Int#bytes returns an Array(UInt8) representing the integer in big-endian encoding
      - Int.fromBytes takes an Array(UInt8) and returns the integer it represents (similar to Float32.fromBytes / Float64.fromBytes)
    - Added utility method withIO
      - Takes an arbitrary number of IO objects and a block
      - Yields all given IOs to the block, in the order they were passed
      - Closes all given IOs after the block finishes executing
      - Returns the return value of the block
    - Removed withStdin and withStdout macros
    - Modified opcode macro
      - Now takes an optional named parameter stdin : String, to be passed via stdin to the interpreter
      - Now takes an optional named parameter stdout : String, to be compared to the resulting stdout (fails the test if it does not match)
      - Now auto-flattens arrays in the bytes parameter, allowing for arbitrary interspersing of bytes/arrays of bytes
      - Now uses withIO internally to deal with IO tests, rather than manually using withStdin/withStdout externally
    - Updated tests to take advantage of above changes
Commits on Jan 11, 2019
  1. Add opcodes for value comparisons (==, !=, >, etc)

    swordglowsblue committed Jan 11, 2019
Commits on Jan 10, 2019
  1. Move type queries from 0x5_ to 0x1_

    swordglowsblue committed Jan 10, 2019
    This puts them next to literals, making their symmetry more intuitive and easily maintainable.
  2. Shift sections above Literals down to fill space

    swordglowsblue committed Jan 10, 2019
    With the removal of the `Constructors` section, the other sections are free to move down into that slot.
  3. Remove distinction between literals / constructors

    swordglowsblue committed Jan 10, 2019
    - Collapses `0x10 list` into the Literals section as `0x0a list`
    - Collapses `0x60 list?` into the Literals subsection of Type Queries as `0x5a list?`
    - `0x0a list` now requires a `u32` length value after it, rather than popping its length from the stack.
    - List item handling on construction is unchanged.
Commits on Jan 9, 2019
  1. Implement type queries

    swordglowsblue committed Jan 9, 2019
Commits on Jan 8, 2019
Commits on Jan 7, 2019
  1. Convert manual tests to Crystal specs

    swordglowsblue committed Jan 7, 2019
    Run tests: `crystal spec`
    Run tests with stack display: `crystal spec -Dstack`
  2. Add Float support (f32/f64)

    swordglowsblue committed Jan 7, 2019
    Went into this expecting it to be relatively simple, couldn't have been more wrong. Ended up just wrangling some pointers in the end, the results from Float#from_io were too inconsistent and erroneous.
  3. Remove spec for variable operations

    swordglowsblue committed Jan 7, 2019
    I want to rethink how variables are going to be handled, then rewrite the spec once that's decided. For now, nothing is implemented anyway.
  4. Add Array#bitwiseConcat utility method

    swordglowsblue committed Jan 7, 2019
    Added Array#bitwiseConcat(size = 8), equivalent to `.reduce{|a,b| (a<<size)+b}`. This also fixes a bug with string literal length.
Commits on Jan 6, 2019
  1. Refactor to preprocess bytecode before execution

    swordglowsblue committed Jan 6, 2019
    This commit creates a "parsing" step that abstracts over the actual byte representation of opcodes, allowing execution code for literals to work with sandboxed arrays of data bytes, rather than directly working with the raw bytes following the current opcode. Moving forward, this will also allow for pre-registering labels for control flow operations, as well as potential future optimizations (eliminating values that are pushed and immediately dropped, etc.).
  2. Change spec type terminology, shift IO/var ops up

    swordglowsblue committed Jan 6, 2019
    - Changed type terminology in specs from int to num (to avoid confusion with i32/i64)
    - Shifted IO/variable ops up a section to make room for putting arithmetic in a more logical place
    - Updated code/tests to reflect said shift
  3. Fix some names

    swordglowsblue committed Jan 6, 2019
    Naming is important.
  4. Un-idiotify some things

    swordglowsblue committed Jan 6, 2019
    Developing tired probably isn't the best idea.
  5. Initial version

    swordglowsblue committed Jan 6, 2019
  6. Initial commit

    swordglowsblue committed Jan 6, 2019