X-Git-Url: https://code.kerkeslager.com/?p=fur;a=blobdiff_plain;f=README.md;fp=README.md;h=8ea0e99043bbfedf93a562139bff7832b79ca48e;hp=d00a607e12eb49cab49ffdb702e33ccd018ed2e9;hb=732b4ed7f693a328509b94d7137f3210c9c4042f;hpb=c24be69b26aedc427c7831f150e86ca00182d8e0 diff --git a/README.md b/README.md index d00a607..8ea0e99 100644 --- a/README.md +++ b/README.md @@ -9,14 +9,9 @@ furry animals, so Fur is named in their honor. 2. Install dependencies from `requirements.txt` using `pip`: `pip install -r requirements.txt`. 3. That's all! -## Integration tests - -To run the unit tests, run `python integration_tests.py`. You can test just the output of the examples or just the memory usage of the tests by running -`python integration_tests.py OutputTests` or `python integration_tests.py MemoryLeakTests` respectively. - # Running -Example Fur programs are in the `examples/` folder. The main compiler (`main.py`) compiles Fur +Example Fur programs are in the `examples/` folder. The main compiler (`main.py compile`) compiles Fur programs to C. An example of usage: ~/fur$ python main.py examples/01_hello.fur @@ -24,6 +19,31 @@ programs to C. An example of usage: ~/fur$ ./a.out Hello, world~/fur$ +You can also run the programs through an interpreter (`main.py interpret`): + + ~/fur$ python main.py examples/01_hello.fur + Hello, world$ + +The final way to invoke the main program is `main.py ir`. This outputs an intermediate "assembly" for the bytecode representation of the program: + + ~/fur$ python main.py ir examples/01_hello.fur + __main__: + push_string "Hello, world" + push sym(print) + call 1 + drop + end nil + +## Integration tests + +Integration tests are divided into three categories: + +* Compiler output tests: test that compiled Fur programs give expected output. Run with `python integration_tests.py CompilerOutputTests`. +* Interpreter output tests: test that interpreted Fur programs give expected output. Run with `python integration_tests.py InterpreterOutputTests`. +* Memory lead tests: test that compiled Fur programs don't leak memory (requires Valgrind). Run with `python integration_tests.py MemoryLeakTests`. + +Calling `python integration_tests.py` with no arguments runs all the integration tests. + ## Disclaimers Fur is GPL 3 and will only ever target GPL compilers. Fur supports closures, integer math, boolean