-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Token capture #481
Comments
On the face of it, this one seems complex. |
The current parse order was part of the origninal design ... it's not a bug |
It's not simply a reversal of direction. |
Another example of the inconsistency of the current process used by Kona (left-to-right token capture, with some special-case adjustments):
|
In k/kona parsing is done left to right. Evaluation right to left. The problem here is in error handing, not parsing or evaluation. This can be seen by e.g. comparing how Conceptually what happens is that parsing creates a parse tree for each statement. During evaluation if there is any error, evaluation of the rest of the tree is abandoned. This is what happens in k3 but not in kona. As can be seen by Now consider what happens with I think that in k3, evaluating Recommendation: fix the top level behavior to match k3. Second, fix behavior after an error. For functions it would be nice if evaluation of functions such as |
First of all ... thanks for your comment. I agree that (currently) kona parses left to right and evaluaties right to left, and that kona has a problem in error handling. Some errors can be caught while parsing, and some errors can only be caught Currently, in kona, it seems that the parse process has multiple steps. First, a line is converted to tokens. Then, a parse tree is created for the whole line (not a separate parse tree for each statement). While creating the parse tree, kona "captures" each token in order to include it in the parse tree. On a first look, it appears to me that more errors could be identified during parse-tree creation if token-capture (within a statement) was done right to left. (This theory may or may not work out.) At the top level, kona (just like k3) treats statements within a function differently from normal statements. For your example, |
It's probably useful to get A+ working on Fedora, and examine the parsing and error handling used there. |
Right about kona and Let me try again. K3 captures a parse of one or more complete top level expressions in one or more lines before evaulating them. For example
This will produce three top leve parse trees (or one, if you consider "sequence" as a node). Now if |
The case you identified can be fixed with an adjustment to the "capture" part of the parse process. The case which is causing me to wonder whether the "capture" order (within a statement) in the parse process should be right-to-left is |
Meanwhile, I was able to get A+ (from www.aplusdev.org) to compile and install on Fedora-26. I also got XEmacs running on Fedora-26 (which is the recommended environment for running A+). I'm currently having a problem getting the APL fonts to work. Hope to resolve that this weekend. Then, maybe, I can find out what A+ does in the case that is equivalent to the kona case of |
Re: token capture order. This is how I view the process: parsing goes from left to right but nothing is evaluated during parsing. Not even symbol lookup. Thus for example, given
Here The first sub-tree is Note that |
Your view is of how the process should work ... and that view make sense. |
However, your view is sort of making my point. |
Got the APL fonts to work in Mozilla Firefox, but not yet in XEmacs. |
An even simpler example of the problem:
|
in kona
in k3.2
The text was updated successfully, but these errors were encountered: