git @ Cat's Eye Technologies Zzrk / 3537fa0
Markdown fixes for README. Cat's Eye Technologies 11 years ago
1 changed file(s) with 22 addition(s) and 22 deletion(s). Raw diff Collapse all Expand all
00 Zzrk - Adventures in the Great Unsaturated Grammar
1 ====
1 ==================================================
22
33 What is it?
44 -----------
2121
2222 First, you need an implementation of Zz. The only one I've found, and
2323 subsequently the one I've written Zzrk around, is OpenZz. It can be
24 gotten from http://openzz.sourceforge.net/.
24 gotten from [http://openzz.sourceforge.net/](http://openzz.sourceforge.net/).
2525
2626 Although OpenZz does have an interactive mode, it unfortunately assumes
2727 you're using Zz to describe a compiler. Since I assume you'll want to
3030 happens), here's a guide to working around some of OpenZz's drawbacks.
3131
3232 First, you can't just specify zzrk.zz as the input to ozz. Instead,
33 start OpenZz, then at the "ozz>" prompt, type
33 start OpenZz, then at the `ozz>` prompt, type
3434
3535 /include "zzrk.zz"
3636
37 You can then treat the "ozz>" prompt as the prompt for the adventure
37 You can then treat the `ozz>` prompt as the prompt for the adventure
3838 game parser. Try the usual actions, and see what happens. Be forewarned
3939 that any unrecognizable command on your part -- an unknown verb, noun, or
4040 other part of speech -- will trigger a syntax error. And, because OpenZz
4949 puzzles just to demonstrate that the standard adventure game furniture can
5050 be concocted in Zz. Collecting treasures will get you points, and
5151 obtaining 50 points will win the game (that is, if you have 50 points and
52 you type "score", you will get a message telling you that you have won.
52 you type `score`, you will get a message telling you that you have won.
5353 You will still need to quit OpenZz through some other manual action, such
5454 as typing Ctrl-D, or causing syntax errors.)
5555
5757 Comments
5858 --------
5959
60 I originally wrote zzrk.zz on November 21st, 2003. I gave it actual
60 I originally wrote `zzrk.zz` on November 21st, 2003. I gave it actual
6161 puzzles, wrote this readme, and released it under a BSD license on
6262 May 6, 2007.
6363
6464 A couple of annoying things about Zz...
6565
66 The documentation for OpenZz doesn't mention that the /if { } construct
67 has a variant that takes an else clause. And, /return does not actually
66 The documentation for OpenZz doesn't mention that the `/if { }` construct
67 has a variant that takes an `else` clause. And, `/return` does not actually
6868 cause an immediate return, it only assigns a value to the nonterminal
6969 under consideration. For these reasons, I was originally writing many of
70 my tests twice (like /if a == b {} /if a != b {}). Then I noticed, in
71 examining the results of /krules, that the kernel does in fact support
72 else. The fact that curly braces actually denote lists means they're not
70 my tests twice (like `/if a == b {} /if a != b {}`). Then I noticed, in
71 examining the results of `/krules`, that the kernel does in fact support
72 `else`. The fact that curly braces actually denote lists means they're not
7373 optional in tests though, and the nesting is still pretty annoying.
7474
7575 The other annoying thing is that there's no way to prioritize selection
7676 of nonterminals. For example, I feel very strongly that it ought to be
77 possible to write the score_of production like this:
77 possible to write the `score_of` production like this:
7878
79 /$num_t -> "score_of" coin { /return 5 }
80 /$num_t -> "score_of" jewel { /return 10 }
81 /$num_t -> "score_of" sceptre { /return 15 }
82 /$num_t -> "score_of" crown { /return 20 }
83 /$num_t -> "score_of" object^$ { /return 0 }
79 /$num_t -> "score_of" coin { /return 5 }
80 /$num_t -> "score_of" jewel { /return 10 }
81 /$num_t -> "score_of" sceptre { /return 15 }
82 /$num_t -> "score_of" crown { /return 20 }
83 /$num_t -> "score_of" object^$ { /return 0 }
8484
85 On the basis that coin et al. are more specific than object^$, and should
85 On the basis that `coin` et al. are more specific than `object^$`, and should
8686 be selected before it. But, it's not possible to set this up, at least as
8787 far as I can see. Which is a pity, because this sort of "catch-all"
8888 mechanism would also enable much better error handling.
101101 magic word is, you can't even use it without causing a syntax error.
102102 But afterward it is a full-fledged part of the parser's vocabulary.
103103 Note also that this is how the properties of an object are updated:
104 the production which handles "e_exit square_room" is replaced by one
104 the production which handles `e_exit square_room` is replaced by one
105105 that returns a different value, once the door is open.
106106
107107 Some of the action productions are a bit clumsy because they contain
108108 logic that should probably be associated with the object instead.
109109 Putting lists of statements in a property of the object, and using
110 Zz's /execute facility, would probably allow a "method-like" style
110 Zz's `/execute` facility, would probably allow a "method-like" style
111111 that permits this, but I haven't played with it.
112112
113113 Lastly, it's interesting to note that internal helper functions (not
128128
129129 Happy adventuring!
130130
131 -Chris Pressey
132 May 6, 2007
131 -Chris Pressey
132 May 6, 2007
133133 Vancouver, BC