luau/prototyping
2022-04-15 19:19:42 -05:00
..
Examples Prototyping: strings (#390) 2022-03-02 15:26:58 -08:00
FFI Prototyping: add semantic subtyping (#424) 2022-03-23 15:02:57 -05:00
Luau Unified strict and nonstrict mode in the prototype (#458) 2022-04-15 19:19:42 -05:00
Properties Unified strict and nonstrict mode in the prototype (#458) 2022-04-15 19:19:42 -05:00
Tests Prototype: Renamed any/none to unknown/never (#447) 2022-04-09 00:07:08 -05:00
Utility Prototype bools and relational operators (#387) 2022-02-24 11:17:46 -08:00
.gitignore Prototyping strict mode (#399) 2022-03-02 16:02:51 -06:00
Everything.agda Prototyping strict mode (#399) 2022-03-02 16:02:51 -06:00
Examples.agda Add a typeToString function to the prototype (#354) 2022-02-11 14:38:35 -06:00
Interpreter.agda Prototyping strict mode (#399) 2022-03-02 16:02:51 -06:00
PrettyPrinter.agda Prototyping strict mode (#399) 2022-03-02 16:02:51 -06:00
Properties.agda Prototyping: add semantic subtyping (#424) 2022-03-23 15:02:57 -05:00
README.md Prototyping: Revise CI (#371) 2022-02-17 17:15:33 -08:00
tests.py Rename tests to tests.py (#374) 2022-02-18 10:04:38 -08:00

Prototyping Luau

prototyping workflow

An experimental prototyping system for the Luau type system. This is intended to allow core language features to be tested quickly, without having to interact with all the features of production Lua.

Building

First install Haskell and Agda.

Install dependencies:

  cabal update
  cabal install --lib aeson scientific vector

Then compile

  agda --compile PrettyPrinter.agda

and run!

  luau-ast Examples/SmokeTest.lua | ./PrettyPrinter

Testing

We have a series of snapshot tests in the Tests/ directory. You interact with the tests using the tests Python script in the prototyping directory. To simply run the tests, run:

tests --luau-cli ../build/luau-ast --build

This will build the test targets and run them. Run tests --help for information about all the command-line options.

Adding a new test

To add a new test, add it to Tests/{SUITE_NAME}/{CASE_NAME}. You'll need an in.lua file and an out.txt file. The in.lua file is the input Luau source code, while the out.txt file is the expected output after running luau-ast in.lua | test_executable.

Updating a test

If you make a change to the prototype that results in an expected change in behavior, you might want to update the test cases automatically. To do this, run tests with the --accept-new-output (-a for short) flag. Rather than diffing the output, this will overwrite the out.txt files for each test case with the actual result. Commit the resulting changes with your PR.