I am going by experiment, not looking at the source, but I think it's
like this:
Sometimes the interpreter executes a fragment and expects a certain part
of speech back. Getting a different part of speech is flagged as a
syntax error. Most notable of these is execution of a verb, where
returning anything but a noun is a syntax error.
Here, executing the train N0 (A1 A2) first executes (N0 A1) to produce
R3, then executes (R3 A2). But it first checks to make sure that R3 has
the correct part of speech. It seems to accept noun or verb as OK, but
give syntax error on adverb or conjunction. This behavior is not
defined in the Dictionary.
The proposed change would be simply to accept adverb as an allowed
return for R3. In that case the execution of N0 (A1 A2) would return
(R3 A2), another adverb train.
I don't see any strong objection to that.
I would object to pushing words (A1, A2, or R3) back onto the execution
stack since that would break tools such as trace and dissect that expect
the stack to behave according to Ye Dic.
Henry Rich
On 3/15/2016 5:42 PM, Thomas Costigliola wrote:
This is getting off course, but I will try to clarify. Here are the
current parsing rules:
EDGE VERB NOUN ANY 0 Monad
EDGE+AVN VERB VERB NOUN 1 Monad
EDGE+AVN NOUN VERB NOUN 2 Dyad
EDGE+AVN VERB+NOUN ADV ANY 3 Adverb
EDGE+AVN VERB+NOUN CONJ VERB+NOUN 4 Conj
EDGE+AVN VERB+NOUN VERB VERB 5 Fork
EDGE CAVN CAVN ANY 6 Bident
NAME+NOUN ASGN CAVN ANY 7 Is
LPAR CAVN RPAR ANY 8 Paren
As I have been saying, there is no additional parsing that takes place
for adverb trains, all that happens is that the rule or "action" in
the fourth row, called "3 Adverb", is applied. That is, the adverb
(created from a train) is applied to it's argument and the result
returned. However, I don't see a precise definition anywhere of what
an adverb train does, in the sense that there is a precise definition
of what the adverb / does (I have not scoured the dictionary for it
though, so correct me if I am wrong.) SO, if you were to re-specify
somehow the behavior of adverb trains as it applies to parsing (I
don't see a rule in that table) you could avoid speaking about what
happens in the "action" and explicitly state what happens in the parse
table thus avoiding the current implementations behavior of trying to
"apply an adverb to an adverb".
One way to do it perhaps is by stating that an adverb train applies
its leading adverb to its argument and places the result back in the
queue in place of the argument while removing the leading adverb from
the train and continues parsing. I think that would result in the
behavior that is being proposed.
Maybe some other description of the behavior makes it more explicitly
evident that a syntax error should follow.
But all in all, that description eludes me.
On 03/15/2016 05:01 PM, Raul Miller wrote:
I am trying to make sense of this proposal:
change the parsing rules so that the application of adverb trains
are part of parsing and not built in to action "3 Adverb".
What does this even mean?
The "3 Adverb" action is a parsing action.
So it's sort of like you are saying "the application of adverbs should
not be a part of parsing but should instead be a part of parsing".
But that doesn't make any sense to me.
So, I guess maybe what you are proposing is to get rid of the parser
described by http://www.jsoftware.com/help/dictionary/dicte.htm and
replace it with an entirely different parser which works almost
exactly the same except that it does something different?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm