Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

APL Parsers for Dyalog

58 views
Skip to first unread message

Aaron W. Hsu

unread,
Feb 6, 2012, 7:56:23 PM2/6/12
to
Does anyone here know of a publically available parser for the Dyalog APL
language?

--
Aaron W. Hsu | arc...@sacrideo.us | http://www.sacrideo.us
Programming is just another word for the lost art of thinking.

Phil Last

unread,
Feb 7, 2012, 6:02:38 AM2/7/12
to
On Feb 7, 12:56 am, Aaron W. Hsu <arcf...@sacrideo.us> wrote:
> Does anyone here know of a publically available parser for the Dyalog APL
> language?
>
> --
> Aaron W. Hsu | arcf...@sacrideo.us |http://www.sacrideo.us
> Programming is just another word for the lost art of thinking.

All APLs incorporate a parser so I guess that's NOT what you mean.
Can you elaborate by giving a short example of expected input and
output.

Aaron W. Hsu

unread,
Feb 7, 2012, 12:53:40 PM2/7/12
to
Phil Last <phil...@ntlworld.com> writes:

>All APLs incorporate a parser so I guess that's NOT what you mean.
>Can you elaborate by giving a short example of expected input and
>output.

Let's call this function PARSE∆APL. Now, given a character array of
APL code (either a vector of characters with newlines, or a matrix
of characters, with one row per line), I would like PARSE∆APL to give me
some sort of syntax object for manipulating and analyzing the APL code. For
example, maybe I give it this:

PARSE∆APL '⍎(XAV=0)/''⍳20'''
0 1 ⍎ 1 2
0 3 2 9
1 2 XAV 3 6
1 1 = 6 7
1 4 0 7 8
0 1 / 9 10
0 5 ⍳20 11 14

Or something like that, where I can get some sort of analysis of the nesting
levels, the functions, and everything else. That is, a proper parser for APL
code.

--
Aaron W. Hsu | arc...@sacrideo.us | http://www.sacrideo.us

Roger Hui

unread,
Feb 7, 2012, 2:53:35 PM2/7/12
to
To my knowledge (and surprise) no one has such a function. For the
"APL2 school", the parser logic would be based on the <i>APL Two by
Two</i> paper by Bunda & Gerth in APL84, http://dl.acm.org/citation.cfm?id=801081;
for the "Dictionary APL school" (aka J), there are Table 2 and Section
II.I in <i>A Dictionary of APL</i>, http://www.jsoftware.com/papers/APLDictionary.htm,
and Section II.E in <i>J Introduction and Dictionary</i>,
http://www.jsoftware.com/help/dictionary/dicte.htm . The J
implementation is designed and build around the table in Section II.E.



On Feb 7, 9:53 am, Aaron W. Hsu <arcf...@sacrideo.us> wrote:
> Phil Last <phil.l...@ntlworld.com> writes:
> >All APLs incorporate a parser so I guess that's NOT what you mean.
> >Can you elaborate by giving a short example of expected input and
> >output.
>
> Let's call this function PARSE∆APL. Now, given a character array of
> APL code (either a vector of characters with newlines, or a matrix
> of characters, with one row per line), I would like PARSE∆APL to give me
> some sort of syntax object for manipulating and analyzing the APL code. For
> example, maybe I give it this:
>
>       PARSE∆APL '⍎(XAV=0)/''⍳20'''
>  0  1  ⍎    1 2
>  0  3       2 9
>  1  2  XAV  3 6
>  1  1  =    6 7
>  1  4  0    7 8
>  0  1  /    9 10
>  0  5  ⍳20  11 14
>
> Or something like that, where I can get some sort of analysis of the nesting
> levels, the functions, and everything else. That is, a proper parser for APL
> code.
>
> --
> Aaron W. Hsu | arcf...@sacrideo.us |http://www.sacrideo.us

Bob Smith

unread,
Feb 14, 2012, 3:52:54 PM2/14/12
to
On 2/7/2012 2:53 PM, Roger Hui wrote:
> To my knowledge (and surprise) no one has such a function. For the
> "APL2 school", the parser logic would be based on the<i>APL Two by
> Two</i> paper by Bunda& Gerth in APL84, http://dl.acm.org/citation.cfm?id=801081

You can find an .atf file of the Bunda/Gerth algorithm (with recent
corrections from the authors) at
http://www.nars2000.org/download/workspaces/2by2.atf.

--
_________________________________________
Bob Smith -- bsm...@sudleydeplacespam.com

To reply to me directly, delete "despam".

danb

unread,
Feb 21, 2012, 7:58:06 AM2/21/12
to
On Feb 7, 5:53 pm, Aaron W. Hsu <arcf...@sacrideo.us> wrote:
> Phil Last <phil.l...@ntlworld.com> writes:
> >All APLs incorporate a parser so I guess that's NOT what you mean.
> >Can you elaborate by giving a short example of expected input and
> >output.
>
> Let's call this function PARSE∆APL. Now, given a character array of
> APL code (either a vector of characters with newlines, or a matrix
> of characters, with one row per line), I would like PARSE∆APL to give me
> some sort of syntax object for manipulating and analyzing the APL code. For
> example, maybe I give it this:
>
>       PARSE∆APL '⍎(XAV=0)/''⍳20'''
>  0  1  ⍎    1 2
>  0  3       2 9
>  1  2  XAV  3 6
>  1  1  =    6 7
>  1  4  0    7 8
>  0  1  /    9 10
>  0  5  ⍳20  11 14
>
> Or something like that, where I can get some sort of analysis of the nesting
> levels, the functions, and everything else. That is, a proper parser for APL
> code.
>
> --
> Aaron W. Hsu | arcf...@sacrideo.us |http://www.sacrideo.us
> Programming is just another word for the lost art of thinking.

Not sure this will help you but there is a user command in Dyalog that
does calling tree analysis and can provide details on names used in
each call at each level. See ]??fncalls for details.
0 new messages