I'd suggest the following syntax conventions for J:
Variable names:
Adverbs and Nouns start with upper case
conjunctions and verbs start with lower case
(Useful but optional: VARIABLENOUN vs CONSTANt or VariableNoun vs CONSTANT)
Spacing between words is to be relative to minimal spacing which varies (0 or
1) between built-ins, literals, and variables. There are 3 recommended spacing
minimal, minimal +1, and minimal+2
Spacing rules:
Conjunctions have minimal spacing to their right arg.
Adverbs have minimal+1 spacing to their left arg
Verbs have minimal+2 spacing to their right arg
Dyadic verbs have minimal +1 spacing to their left arg.
With these rules, any expression can be read without knowing the form of speech
of individual words.
(where v=verb, n=noun, a=adverb, c= conjunction (x)=parenthesised expression)
a B c D is v n v n
< 2 - 1 is same
a + 2 &(c d E) is v + 2 &(v c n)
a B or a b is adverb (c n or c v)
A B is verb phrase or adverb: n a or a a
A B C is verb phrase or adverb: n a a or a a a
A b C is noun: n v n
A B C is noun: n a n
a B is noun: v n
a b is adverb: v c
a b c is verb phrase: v c v
a B is verb phrase : v a
a B C is verb phrase : v a a
A B C is verb phrase or adverb : n a a or a a a
a b is hook: v v
a b C is hook: v v a
a b C is noun: v v n
(x)a or (x)A is adverb: x must resolve to c
(x) a B is noun: n v n
(x) a is hook: v v
(x) a b is fork: v v v or n v v
A (x) is adverb or verb phrase: a a or n c or n a
A (x) B is noun: n a n
A (x) B is adverb or verb phrase: n a a or a a a
A (x)b is verb phrase: n c v
a (x) is v c or v a
a (x)b is verb phrase: v c v
a (x) B is verb phrase: v a a
a (x) is hook or noun: v v or v n
Some Notes:
The spacing corresponds to the bonding order (closer words bond higher than
distant words)
The ambiguous cases of whether the left most word of an expression is a noun or
adverb when all other elements of the leftmost verb phrase are adverbs would
come up less frequently than the alternate ambiguities that occur when you make
conjunctions and nouns be the designated upper case variables.
Higher order adjectives (adjectives that return adjectives) can be spaced
appropriately by parenthesising them as shown in the (x) examples above, with a
lot of ambiguity resolved.
On another note, why must this be a syntax error:
a c v while a (c v) is not? I might be missing something (as usual), but
would understand the 2 expressions to be equivalent.
Be smarter than spam. See how smart SpamGuard is at giving junk email the
boot with the All-new Yahoo! Mail at http://mrd.mail.yahoo.com/try_beta?.intl=ca
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm