Added some explanation for the project to the README.
[vvhitespace] / README.md
CommitLineData
92a92075
AT
1# Overview #
2
be99c013 3Welcome to VVhitespace!
92a92075 4
be99c013
AT
5If you are impatient to get started, simply execute `make` in the top-level
6directory to build the compiler and interpreter, then move to one of the
2d81bb77 7example directories like `examples/hunt-the-wumpus` and execute `make run`.
92a92075 8
be99c013
AT
9VVhitespace is descended from Whitespace, adding a vertical tab to the language
10along with some restrictions to ease implementation. VVhitespace code is
11represented with the *whitespace characters* `[Tab]`, `[VTab]`, `[Space]`, and
12`[Newline]`. All other characters are considered commentary.
13
139a7977
AT
14VVhitespace makes a number of small changes to Whitespace with the intention of
15*taming* it by providing the tools necessary in order to make non-trivial
16whitespace-only applications. As proof of concept, I wrote an implementation of
17Hunt the Wumpus in VVhitespace.
18
be99c013
AT
19This repository includes several distinct parts:
20
21 - A compiler, `vvc`, accepts human-readable VVhitespace source code and
22 translates it to true VVhitespace code.
23
24 - An interpreter, `vvi`, accepts true VVhitespace files as generated by `vvc`
25 and executes them according to the rules in `reference.md`.
26
27 - A library of useful functions including enhanced stack operations, printf,
28 math operations including random number generation, heap operations, string
29 manipulations and user interactions, and bitwise logic functions. See the
30 `stdlib/README.md` for more details.
31
32 - Hunt the Wumpus, a text game in which you explore a randomly connected set
33 of caverns, avoiding deep pits and giant cave bats, all while shooting
34 arrows at a Wumpus that wants to eat a tasty, meaty human like yourself! The
35 cave entrance is rumored to be near `examples/hunt-the-wumpus/README.md`.
36
37 - Examples including code commentary that demonstrate VVhitespace and the
38 stdlib. See individual subdirectories under `examples/` for details.
39
40 - Tests for both the VVhitespace language and the stdlib. Intended to
41 increase confidence for users that want to tinker with the internals, both
42 test suites come with a README explaining how to run the tests and extend them
43 as necessary. To execute all tests, simply run `make test` in the top level
44 directory.
45
46From this point forward, READMEs will assume you have a basic knowledge of
47VVhitespace (or at least Whitespace). The file `reference.md` provides a short
48but comprehensive language reference copied largely from the original
49Whitespace language tutorial.
50
51
52# Status #
53
54Complete. Tested on FreeBSD and Debian Linux (w/'build-essential' package).
92a92075
AT
55
56
57# Instructions #
58
59To build the VVhitespace software, simply run `make` in the top level directory.
60This will produce two binaries, `vvc` for compiling human-readable
be99c013
AT
61pseudo-VVhitespace into true VVhitespace, and `vvi` for interpreting/executing
62VVhitespace programs.
92a92075
AT
63
64Use these two programs to build and run your VVS programs:
65
66 vvc -i your_code.pvvs -o output_file.vvs
67 vvi -i output_file.vvs
68
be99c013
AT
69By convention, the extension `.pvvs` is used for pseudo-VVhitespace code and
70`.vvs` is used for true VVhitespace code.
71
72The stdlib uses the C preprocessor to `#include` library files. Projects like
73`examples/hello-world` demonstrate combining the stdlib and the C preprocessor
74in the `Makefile`. The invocation will take this general form:
75
76 cpp -I/path/to/stdlib/files -I. -o temp.pvvs your_code.pvvs
77 vvc -i temp.pvvs -o output_file.vvs
78 vvi -i output_file.vvs
79
80Alternatively, you may simply hijack one of the example projects. All are
81pre-configured to compile with the standard library using `make run` and only
82require the user to `#include` the appropriate stdlib files for the functions
83called. For example, if the `printf` function was used, the bottom of the file
84should include this line:
85
86 #include <stdio.pvvs>
87
88Before running the VVhitespace or stdlib tests, read `README.md` in their
89respective directories. It details the steps required to configure the tests.
90Every test is also a minimal example for a single VVhitespace feature or stdlib
91function, with documented input and expected output.
92
93
94# Helpful Hints #
95
96Syntax highlighting greatly eases both reading and writing VVhitespace code.
97Examples for `vim` (and any other editor with regex based syntax highlighting)
98can be found in `syntax_highlighting/README.md`.
99
100In addition to Hunt the Wumpus, the `examples/` directory provides several
101other smaller examples. All have comprehensible `Makefile` and code that is
102easily modified to use as the start of your own project.
92a92075 103
92a92075 104
be99c013 105# Backward Compatibility #
92a92075 106
be99c013
AT
107Since the `[VTab]` character is considered a comment character in Whitespace,
108most VVhitespace code should also be valid Whitespace code, and usually with
109similar results. All other changes to the language attempt to restrict
110implementation impediments without violating the original definition.
92a92075 111
be99c013
AT
112Tests are included for both the core VVhitespace language and the stdlib. After
113compiling with `cpp` and `vvc`, the resulting tests may be executed with any
114Whitespace compiler to identify any specific incompatibilities. Everything has
115been kept simple in the hope it will be easy to modify.
92a92075 116