Are most interpreters table driven??? How is the APL function text
stored???
--
+----------------------------------------+
| Charles and Francis Richmond |
| |
| plano dot net at aquaporin4 dot com |
+----------------------------------------+
For a work-in-progress free open source modern APL interpreter, see
http://www.nars2000.org. Don't spend much time on the syntax analyzer
as it is in the process of being completely rewritten.
--
_________________________________________
Bob Smith -- bsm...@sudleydeplacespam.com
To reply to me directly, delete "despam".
You can type it in, play around with it, see how it works, and try to
extend it. There is no lexical analysis (it only works with ordinary
primitive functions one character each, variables one character long,
and parentheses. No square brackets, indexing or operators, etc.)
It is available on line at:
http://www.softwarepreservation.org/projects/apl/paper/197201_APL%20In%20Exposition_320-3010.pdf
As an exercise, you might try writing a simple lexical analyzer in APL
(a one evening project) such that you can pass to the PARSE function a
nested vector of strings. Then extend the parser to handle multiple
character names, basic operators (+/, +.x, etc.). And maybe later, if
you feel up to it, traditional APL indexing A[B] and axis operators +/
[16]MAT.
Thanks for the reference.
The syntax analyzer I'm using for testing comes from Bunda/Gerth's APL84
paper "APL Two By Two -- Syntax Analysis By Pairwise Reduction". This
analyzer can be changed easily to model a language with different
characteristics such as binding strengths. For example, it's easy to
define a syntax analyzer with these binding strengths:
A B C[I] ←→ (A) (B) (C[I])
+op2 A B C ←→ (+op2 A) B C
where op2 is a dyadic operator.
It is this code on which I plan to base my next APL syntax analyzer,
largely because it's easy to understand and modify.
The APL code may be found at one of the following places
http://www.nars2000.org/download/workspaces/2by2.atf (ATF file)
http://www.nars2000.org/download/workspaces/2by2.ws.nars (NARS2000 ws)
We followed that method when we wrote APL.68000 Level II and its
successor APLX. I vaguely remember that there were some errors in the
tables, but it's a good approach.
Yes, and there were some errors in the functions, too, which I corrected
in the files I referenced. I'm glad to see you used it successfully.
One can even experiment with a different order of execution and
operation precedence, just to see how it would look.
There used to be sources available for some APL systems as well as
older versions of J.
I guess you would be better off with some of those rather than trying
to figure everything out for yourself from scratch.
The latest version of J is to be more or less completely open and
written in J
"JFEs become open source J code and can be developed cooperatively by
the community."
I guess it would be interesting for you to join that effort.
There is a lot of disscussions in the Beta Forums
http://www.jsoftware.com/forums.htm
http://old.nabble.com/J-f24193.html