Add symbol and structure support
[fur] / README.md
1 # fur
2
3 Fur is a programming language for the next millenium. In 1000 years, humans will likely still like
4 furry animals, so Fur is named in their honor.
5
6 ## Installation
7
8 1. Create and activate a virtual environment with Python 3. On most systems, this will look something like `python3 -m venv .env/ && .env/bin/activate`.
9 2. Install dependencies from `requirements.txt` using `pip`: `pip install -r requirements.txt`.
10 3. That's all!
11
12 # Running
13
14 Example Fur programs are in the `examples/` folder. The main compiler (`main.py compile`) compiles Fur
15 programs to C. An example of usage:
16
17     ~/fur$ python main.py examples/01_hello.fur
18     ~/fur$ gcc examples/01_hello.fur.c 
19     ~/fur$ ./a.out
20     Hello, world~/fur$ 
21
22 You can also run the programs through an interpreter (`main.py interpret`):
23
24     ~/fur$ python main.py examples/01_hello.fur
25     Hello, world$
26
27 The final way to invoke the main program is `main.py ir`. This outputs an intermediate "assembly" for the bytecode representation of the program:
28
29     ~/fur$ python main.py ir examples/01_hello.fur
30     __main__:
31         push_string "Hello, world"
32         push sym(print)
33         call 1
34         drop
35         end nil
36
37 ## Integration tests
38
39 Integration tests are divided into three categories:
40
41 * Compiler output tests: test that compiled Fur programs give expected output. Run with `python integration_tests.py CompilerOutputTests`.
42 * Interpreter output tests: test that interpreted Fur programs give expected output. Run with `python integration_tests.py InterpreterOutputTests`.
43 * Memory lead tests: test that compiled Fur programs don't leak memory (requires Valgrind). Run with `python integration_tests.py MemoryLeakTests`.
44
45 Calling `python integration_tests.py` with no arguments runs all the integration tests.
46
47 ## Disclaimers
48
49 Fur is GPL 3 and will only ever target GPL compilers. Fur supports closures, integer math, boolean
50 logic, lists, structures (similar to objects), and strings (implemented as
51 [ropes](https://en.wikipedia.org/wiki/Rope_(data_structure))).  It doesn't yet support
52 exceptions, multithreading, modules, or anything resembling a standard library.  If that sounds
53 like something you want to use in production code, good luck to you.