0 | |
Ypsilax
|
1 | |
=======
|
2 | |
|
3 | |
Language version 1.1, distribution revision 2011.0428.
|
4 | |
Copyright ©2001-2011, Cat's Eye Technologies. All rights reserved.
|
5 | |
|
6 | |
### Overview
|
7 | |
|
8 | |
**Ypsilax** is a minimal, non-deterministic, reflective, two-dimensional
|
9 | |
grid-rewriting language. Ypsilax is a descendent of Zirgulax, which was
|
10 | |
an earlier but similar idea which used a hexnet instead of a grid.
|
11 | |
|
12 | |
An Ypsilax source file is One Big Playfield. This playfield is not
|
13 | |
semantically symmetrical; things closer to the 'top' of the playfield
|
14 | |
have a higher 'precendence' than the things close to the 'bottom'. (I
|
15 | |
experimented with colours and boundaries, and found having a 'sloping'
|
16 | |
playfield was much easier to implement.)
|
17 | |
|
18 | |
[Implementation note. The source for the reference implementation is
|
19 | |
only about 5K of Perl code, and much of that is taken up by the
|
20 | |
license!]
|
21 | |
|
22 | |
A rewriting rule in Ypsilax looks like this:
|
23 | |
|
24 | |
( )
|
25 | |
AB
|
26 | |
|
27 | |
Rules are always twice as wide as they are high. This particular rule,
|
28 | |
which is two cells wide by one cell high, says that it is OK to replace
|
29 | |
any A found below this rule with a B.
|
30 | |
|
31 | |
Ypsilax is totally non-determinstic, like [Thue][]. Each reduction
|
32 | |
consists of picking a rule by an unspecified method — for all you know,
|
33 | |
it is selected completely at random — and attempting to apply it to some
|
34 | |
part of the playfield below the rule, again chosen by means unknown.
|
35 | |
When this suceeds, that part of the playfield is rewritten.
|
36 | |
|
37 | |
[Thue]: http://catseye.tc/projects/thue/
|
38 | |
|
39 | |
[Implementation note: in fact, the reference implementation does indeed
|
40 | |
select rules and places to apply them using Perl's pseudo-random number
|
41 | |
generator. Also, the interpreter dumps an image of the playfield to
|
42 | |
`stdout` whenever a rewrite occurs, for some jolly good entertainment,
|
43 | |
but this is not specified as part of the language semantics proper.]
|
44 | |
|
45 | |
Ypsilax is reflective. This means that you can write rules which rewrite
|
46 | |
other rules. For example, you could write the following rule above the
|
47 | |
previously noted rule, which would rewrite it:
|
48 | |
|
49 | |
( )
|
50 | |
( )( )
|
51 | |
AB CD
|
52 | |
|
53 | |
Note that this rule is, in fact, four cells high, as it is eight cells
|
54 | |
across.
|
55 | |
|
56 | |
However, there is nothing stopping these 'embedded' rules from also
|
57 | |
being randomly picked and applied by some rule that may occur above
|
58 | |
them. To get around that we can 'escape' the
|
59 | |
rules-to-be-matched-instead-of-obeyed:
|
60 | |
|
61 | |
(\ \ )
|
62 | |
( )( )
|
63 | |
AB CD
|
64 | |
|
65 | |
The backslashes do not affect the semantics of the parentheses as
|
66 | |
'define rule'; however they do prevent rewrites on the cells immediately
|
67 | |
below them.
|
68 | |
|
69 | |
Finally, Ypsilax just wouldn't be a proper constraint-based language
|
70 | |
without some form of pattern-matching. (*In 1.1: Updated to agree with
|
71 | |
existing implementation and examples*) The wildcard character in any
|
72 | |
given rule is whatever character appears just to the left of the `)`
|
73 | |
that delimits that rule on the right, as long as that character is not
|
74 | |
blank space. Whereever this character appears in the left-hand side of
|
75 | |
the rule (the pattern,) it will match any character during a rewrite,
|
76 | |
not just another of its own kind. Whereever this character appears in
|
77 | |
the right-hand side of the rule (the substitution,) it will not replace
|
78 | |
the corresponding character in the playfield when a substitution is
|
79 | |
made. That character in the playfield will remain unchanged.
|
|
0 |
Ypsilax
|
|
1 |
=======
|
|
2 |
|
|
3 |
Language version 1.1, distribution revision 2012.0916.
|
|
4 |
Copyright ©2001-2012, Cat's Eye Technologies. All rights reserved.
|
|
5 |
|
|
6 |
### Overview
|
|
7 |
|
|
8 |
**Ypsilax** is a minimal, non-deterministic, reflective, two-dimensional
|
|
9 |
grid-rewriting language. Ypsilax is a descendent of Zirgulax, which was
|
|
10 |
an earlier but similar idea which used a hexnet instead of a grid.
|
|
11 |
|
|
12 |
An Ypsilax source file is One Big Playfield. This playfield is not
|
|
13 |
semantically symmetrical; things closer to the 'top' of the playfield
|
|
14 |
have a higher 'precendence' than the things close to the 'bottom'. (I
|
|
15 |
experimented with colours and boundaries, and found having a 'sloping'
|
|
16 |
playfield was much easier to implement.)
|
|
17 |
|
|
18 |
[Implementation note. The source for the reference implementation is
|
|
19 |
only about 5K of Perl code, and much of that is taken up by the
|
|
20 |
license!]
|
|
21 |
|
|
22 |
A rewriting rule in Ypsilax looks like this:
|
|
23 |
|
|
24 |
( )
|
|
25 |
AB
|
|
26 |
|
|
27 |
Rules are always twice as wide as they are high. This particular rule,
|
|
28 |
which is two cells wide by one cell high, says that it is OK to replace
|
|
29 |
any A found below this rule with a B.
|
|
30 |
|
|
31 |
Ypsilax is totally non-determinstic, like [Thue][]. Each reduction
|
|
32 |
consists of picking a rule by an unspecified method — for all you know,
|
|
33 |
it is selected completely at random — and attempting to apply it to some
|
|
34 |
part of the playfield below the rule, again chosen by means unknown.
|
|
35 |
When this suceeds, that part of the playfield is rewritten.
|
|
36 |
|
|
37 |
[Thue]: http://catseye.tc/projects/thue/
|
|
38 |
|
|
39 |
[Implementation note: in fact, the reference implementation does indeed
|
|
40 |
select rules and places to apply them using Perl's pseudo-random number
|
|
41 |
generator. Also, the interpreter dumps an image of the playfield to
|
|
42 |
`stdout` whenever a rewrite occurs, for some jolly good entertainment,
|
|
43 |
but this is not specified as part of the language semantics proper.]
|
|
44 |
|
|
45 |
Ypsilax is reflective. This means that you can write rules which rewrite
|
|
46 |
other rules. For example, you could write the following rule above the
|
|
47 |
previously noted rule, which would rewrite it:
|
|
48 |
|
|
49 |
( )
|
|
50 |
( )( )
|
|
51 |
AB CD
|
|
52 |
|
|
53 |
Note that this rule is, in fact, four cells high, as it is eight cells
|
|
54 |
across.
|
|
55 |
|
|
56 |
However, there is nothing stopping these 'embedded' rules from also
|
|
57 |
being randomly picked and applied by some rule that may occur above
|
|
58 |
them. To get around that we can 'escape' the
|
|
59 |
rules-to-be-matched-instead-of-obeyed:
|
|
60 |
|
|
61 |
(\ \ )
|
|
62 |
( )( )
|
|
63 |
AB CD
|
|
64 |
|
|
65 |
The backslashes do not affect the semantics of the parentheses as
|
|
66 |
'define rule'; however they do prevent rewrites on the cells immediately
|
|
67 |
below them.
|
|
68 |
|
|
69 |
Finally, Ypsilax just wouldn't be a proper constraint-based language
|
|
70 |
without some form of pattern-matching. (*In 1.1: Updated to agree with
|
|
71 |
existing implementation and examples*) The wildcard character in any
|
|
72 |
given rule is whatever character appears just to the left of the `)`
|
|
73 |
that delimits that rule on the right, as long as that character is not
|
|
74 |
blank space. Whereever this character appears in the left-hand side of
|
|
75 |
the rule (the pattern,) it will match any character during a rewrite,
|
|
76 |
not just another of its own kind. Whereever this character appears in
|
|
77 |
the right-hand side of the rule (the substitution,) it will not replace
|
|
78 |
the corresponding character in the playfield when a substitution is
|
|
79 |
made. That character in the playfield will remain unchanged.
|