Git Product home page Git Product logo

catastrophic-lang's People

Contributors

samuelsleight avatar

Watchers

 avatar  avatar

catastrophic-lang's Issues

Implement more integration tests

In #15 we added the framework for integration tests with a relatively minimal set of tests.

We should add cases for all of the remaining builtins and commands, combinations involving blocks and calls, and a method for testing based on a text file containing user input

Finish the `InputNumber` command

This remains a todo in the compiler output code.

We need to implement a way of handling input in llvm that matches the semantics of how we read input in the interpreter (or in some other sensible way which we then unify)

Implement support for "closures"

It is possible for a function to leave behind a function on the stack that refers to some parent scope, for example:

make_adder: x -> {
    y -> {
        x y + ()
    }
}

The current implementation of functions will not support this, as we basically treat each function as a top-level function and make the assumption that every parent variable will still be in scope. We need some way of detecting this case and wrapping the block as a "closure" in some form, storing the parently arguments as needed.

Refactor the stage/error contexts to improve file handling

We currently open the source file twice - once in the parser, and once when constructing the error context. We should investigate refactoring things to only open the file once, and ideally avoid the mildly cursed `Arc<Mutex`` we have in the error context that shouldn't really be needed as it's all single-threaded!

Finish the `Random` function

In #12, we implmented this in the interpreter leaving a todo in the compiler.

We need to implement a random function in llvm ir with similar semantics to the interpreter such that we can finish off this todo

Implement a random number instruction

We need a "random number" instruction: the semantics are to be fully defined, but it should either

  • Be a "command", and operate immediately, pushing a random number to the stack, or
  • Be a built-in function, and push a random number to the stack when called (potentially with parameters)

Investigate the introduction of a `LIR` between `MIR` and llvm itself

We currently have a HIR which is pretty much just the AST but with names resolved, and a MIR which is pretty much just the HIR but with bespoke instructions introduced by optimisations.

As a result, the code building llvm IR from this is relatively complex as there's a lot of understanding of the format needed - it would be interesting to see if we can move this understanding up a level, and transform this MIR into a LIR with a pretty simple set of instructions (that is ideally as close to llvm IR as reasonable). This will then remove a significant amount of complexity from the llvm builder code, and has the potential to open now optimisation opportunities

Define the result of comparison operations

Comparison operations are currently just directly cast from the boolean result of the comparison - this means:

  • We cannot rely on the result of a comparison for anything other than the ? operator (when we cast it back to a boolean)
  • We cannot easily write an integration test for comparisons, as the result is implenentation dependent

Implement integration tests

We currently have (some) unit tests testing basic functionality of the parser etc - we should also have some much higher level tests testing that the compiler (or interpreter) as a whole actually work as expected, probably taking source files and an expected output from the compiler.

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.