Raul wrote:
> But I would really like an actual spec.
The language of the divine scroll is lost, but we can try to draw some
conclusions from the two remaining (public) examples:
1. x
2. x
3. b
4. 8b+13
5. 19a+b-d-g+15
6. a+11h
7. c
8. 2e+2i-k-h+u+32
9. h-u+q+90
10. h-u+q+n+19
and
1. x
2. 5b+c
3. 3(b+25)
4. 8(b+11)
5. 19a+d-m
6. a+11h
7. 60(5-e)+c
8. 2j-k-h+n
9. h-n+w+110
10. q+5-n
Well, there definitely seems to be a pattern here.
These scripts only exhibit the characters ()+-01235689abcdeghijkmnquwx
but let's infer the full alphabet of this language is ()+-012345678
abcdefghijklmnopqrstuvwxy (that is, (,),+,-,all decimal digits, all
lowercase letters, and space, which is ignored).
A script in this language is broken into sentences and sentences into words.
Sentences are delimited by newlines, and words of a sentence are determined
as follows: (, ), +, -, any single lowercase letter, and any non-negative
decimal integer, are all separate words. Put another way, strings of digits
are the only multi-character words; any non-digit is a word unto itself.
A sentence is understood (interpreted) as a simple arithmetical expression.
The operations permitted in this expression are addition, subtraction, and
multiplication. Addition and subtraction are explicitly represented by +
and - respectively. Multiplication is denoted by juxtaposition of operands.
Multiplication takes precedence over addition and subtraction; ambiguities
of precedence between addition and subtraction are resolved by interpreting
the sentence left-to-right.
Operands are of 3 types: non-negative decimal integers (represented as
usual), variables (single letters), and parenthesized expressions in this
same language, to be interpreted recursively.
In the examples above, multiplication always appears to take a decimal
operand on the left and a non-decimal operand on the right, but we might
like to generalize this to admit any kind of operand on either side.
This isn't bulletproof, but it should give us a good start.
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm