bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Syntax error on function )COPY'd from another workspace


From: Dr . Jürgen Sauermann
Subject: Re: Syntax error on function )COPY'd from another workspace
Date: Tue, 11 Feb 2025 18:00:34 +0100
User-agent: Mozilla Thunderbird

Hi Hans-Peter,

thanks, that helps. I will have a closer look.

Best Regards,
Jürgen


On 2/11/25 15:12, Hans-Peter Sorge wrote:
shorts and more ...

1. create function  emacs workspaces/WWW.apl

#!/usr/local/bin/apl --script
⎕FX ⎕INP '⍝∆∆∆'
WWW
ws←3↓1⊃⍎')WSID'
→ x                                                                                            
x:                                                                                             
marker ← ⊂'⍝','∆∆∆'                                                                                   
⍝∆∆∆

2. In apl:

     )clear
CLEAR WS
     )copy WWW
DUMPED 2025-02-11  15:00:26 (GMT+1)  
WWW
     WWW
SYNTAX ERROR
WWW[4]  marker←⊂'⍝','∆∆∆' ⍝the command itself executes w/o
SYNTAX ERROR
       ^          ^
     )reset
     ∇WWW∇
     WWW
     marker

⍝∆∆∆

⍝ -------------------------------------------------------------------------------------------------------------

3. Modify workspaces/WWW.apl (⍝→ x) :

#!/usr/local/bin/apl --script
⎕FX ⎕INP '⍝∆∆∆'
WWW
ws←3↓1⊃⍎')WSID'
⍝→ x                                                                                            
x:                                                                                             
marker ← ⊂'⍝','∆∆∆'                                                                                   
⍝∆∆∆


4. In apl
     )clear
CLEAR WS
     )copy WWW
DUMPED 2025-02-11  15:06:53 (GMT+1)  
WWW
     WWW
     marker

⍝∆∆∆

Best Regards
Hans-Peter




Am 10.02.25 um 22:46 schrieb Hans-Peter Sorge:
OK - Back to the drawing board ....


apl

⍝ Assertion:
⍝ The sequence of bold commands seems to be required to produce the stack trace
⍝ If I left out either
⍝  the 2nd
)copy Editor
⍝  or EEE←⎕CR 'E∆Edit'
⍝  or
T∆E∆Edit ←⍳0
⍝  to shorten the cause for the stack trace the  SYNTAX ERROR was gone.

     ∇x
[1] 'xxxxxxxxx'
[2] ∇
     )copy Editor

SAVED 2025-02-10 09:15:01 (GMT-6)
     E∆Edit 'x'
 
At all prompts you can type 'end' to exit or backup to the previous question.
You can often type 'help' to get help.
 
Enter your edit command?  help
Enter your edit command?  help
SYNTAX ERROR
E∆Edit[31]  →(2↑bv←qq E∆Pim 'Enter your edit command')/31 34
           ^^
     )reset
     )copy Editor
SAVED 2025-02-10 09:15:01 (GMT-6)
     E∆Edit 'x'
 
At all prompts you can type 'end' to exit or backup to the previous question.
You can often type 'help' to get help.
 
Enter your edit command?  help
Enter your edit command?  help
SYNTAX ERROR
E∆Edit[31]  →(2↑bv←qq E∆Pim 'Enter your edit command')/31 34
           ^^
     T∆E∆Edit ←⍳0
     )reset
     )copy Editor
SAVED 2025-02-10 09:15:01 (GMT-6)
     E∆Edit 'x'
 
At all prompts you can type 'end' to exit or backup to the previous question.
You can often type 'help' to get help.
 
Enter your edit command?  help
Enter your edit command?  help
SYNTAX ERROR
E∆Edit[31]  →(2↑bv←qq E∆Pim 'Enter your edit command')/31 34
           ^^
           )reset
           EEE←⎕CR 'E∆Edit'
           E∆Edit 'x'
 
At all prompts you can type 'end' to exit or backup to the previous question.
You can often type 'help' to get help.
 
             
Enter your edit command?  help
Enter your edit command?  help
SYNTAX ERROR
E∆Edit[31]  →(2↑bv←qq E∆Pim 'Enter your edit command')/31 34
           ^^
           T∆E∆Edit ←⍳0
           )reset
Symbol is: 'EN0' at Symbol.cc:404
*** useless apl.lines (no CXXFLAGS=-rdynamic -gdwarf-2)

----------------------------------------
-- Stack trace at Symbol.cc:405
----------------------------------------
0x7f3571d2a30b __libc_start_main
0x7f3571d2a248   
0x403dfd   main
0x5d2a8b    Workspace::immediate_execution(bool)
0x45ec89     Command::process_line()
0x45ee65      Command::process_line(UCS_string&, std::ostream*)
0x45fd25       Command::do_APL_command(std::ostream&, UCS_string&)
0x5d4993        Workspace::clear_SI(std::ostream&)
0x5d2861         Workspace::pop_SI(char const*)
0x56abd3          StateIndicator::~StateIndicator()
0x56d0f4           UserFunction::pop_local_vars() const
0x5b9efc            UserFunction_header::pop_local_vars() const
0x5784f2             Symbol::pop()
========================================
========================================

----------------------------------------
-- Stack trace at Symbol.cc:1310
----------------------------------------
0x7f3571d2a30b __libc_start_main
0x7f3571d2a248   
0x403dfd   main
0x5d2a8b    Workspace::immediate_execution(bool)
0x45ec89     Command::process_line()
0x45ee65      Command::process_line(UCS_string&, std::ostream*)
0x45fd25       Command::do_APL_command(std::ostream&, UCS_string&)
0x5d4993        Workspace::clear_SI(std::ostream&)
0x5d2861         Workspace::pop_SI(char const*)
0x56abd3          StateIndicator::~StateIndicator()
0x56d0f4           UserFunction::pop_local_vars() const
0x5b9efc            UserFunction_header::pop_local_vars() const
0x578506             Symbol::pop()
0x7f3571d4378e               
0x7f3571d436c1                
0x5d931e                Workspace::~Workspace()
0x5d7466                 Workspace_0::~Workspace_0()
0x5d73ee                  SymbolTable::~SymbolTable()
0x5d7a38                   SymbolTableBase<Symbol, 65536ul>::~SymbolTableBase()
0x41c562                    Symbol::~Symbol()
0x41c526                     Symbol::~Symbol()
0x57ba5e                      Symbol::clear_vs()
========================================
========================================


⍝ Try to prove my assertion:


apl

     ∇x
[1] 'xxxxx'
[2] ∇
      
     )copy Editor

SAVED 2025-02-10 09:15:01 (GMT-6)
      
     E∆Edit 'x'
 
At all prompts you can type 'end' to exit or backup to the previous question.
You can often type 'help' to get help.
 
Enter your edit command?  help
Enter your edit command?  help
SYNTAX ERROR
E∆Edit[31]  →(2↑bv←qq E∆Pim 'Enter your edit command')/31 34
           ^^
     )reset
     E∆Edit 'x'

 
At all prompts you can type 'end' to exit or backup to the previous question.
You can often type 'help' to get help.
 
Enter your edit command?  help
Enter your edit command?  help
SYNTAX ERROR
E∆Edit[31]  →(2↑bv←qq E∆Pim 'Enter your edit command')/31 34
           ^^
     T∆E∆Edit ←⍳0
     )reset
     EEE←⎕CR 'E∆Edit'
     E∆Edit 'x'

 
At all prompts you can type 'end' to exit or backup to the previous question.
You can often type 'help' to get help.
 
Enter your edit command?  help
Enter your edit command?  help
Enter your edit command?  end
     )clear
*** useless apl.lines (no CXXFLAGS=-rdynamic -gdwarf-2)

----------------------------------------
-- Stack trace at Symbol.cc:1310
----------------------------------------
0x7f4e5521030b __libc_start_main
0x7f4e55210248   
0x403dfd   main
0x5d2a8b    Workspace::immediate_execution(bool)
0x45ec89     Command::process_line()
0x45ee65      Command::process_line(UCS_string&, std::ostream*)
0x45f13c       Command::do_APL_command(std::ostream&, UCS_string&)
0x5d40a1        Workspace::clear_WS(std::ostream&, bool)
0x57f57e         SymbolTable::clear(std::ostream&)
0x57f682          SymbolTable::clear_slot(std::ostream&, int)
0x41c562           Symbol::~Symbol()
0x41c526            Symbol::~Symbol()
0x57ba5e             Symbol::clear_vs()
========================================
========================================

----------------------------------------
-- Stack trace at Symbol.cc:1310
----------------------------------------
0x7f4e5521030b __libc_start_main
0x7f4e55210248   
0x403dfd   main
0x5d2a8b    Workspace::immediate_execution(bool)
0x45ec89     Command::process_line()
0x45ee65      Command::process_line(UCS_string&, std::ostream*)
0x45f13c       Command::do_APL_command(std::ostream&, UCS_string&)
0x5d40a1        Workspace::clear_WS(std::ostream&, bool)
0x57f57e         SymbolTable::clear(std::ostream&)
0x57f682          SymbolTable::clear_slot(std::ostream&, int)
0x41c562           Symbol::~Symbol()
0x41c526            Symbol::~Symbol()
0x57ba72             Symbol::clear_vs()
0x7f4e5522978e               
0x7f4e552296c1                
0x5d931e                Workspace::~Workspace()
0x5d7466                 Workspace_0::~Workspace_0()
0x5d73ee                  SymbolTable::~SymbolTable()
0x5d7a38                   SymbolTableBase<Symbol, 65536ul>::~SymbolTableBase()
0x41c562                    Symbol::~Symbol()
0x41c526                     Symbol::~Symbol()
0x57ba5e                      Symbol::clear_vs()
========================================
========================================

Not quite what I expected when zeroing in into the SYNTAX ERROR.


<Workspace wsid="Editor" year="2025" month="2" day="10"
           hour="21" minute="42" second="32" timezone="-21600"
           saving_SVN=" 1828" syntax="1.6.1">


Best Regards
Hans-Peter


Am 10.02.25 um 18:55 schrieb M.Hall:
$  apl
      )clear
CLEAR WS
      →(0=⍴0)/0
SYNTAX ERROR+
      →(0=⍴0)/0
      ^
      )more
branch back into function (→N) without suspended function


Running SVN 1833.

On Mon, Feb 10, 2025 at 10:01 AM Hans-Peter Sorge <hanspetersorge@netscape.net> wrote:
Sorry - 

an even shorter way .

     )clear
CLEAR WS
     →(0=⍴,0)/0
SYNTAX ERROR+
     →(0=⍴0)/0
     ^

Best Regards
Hans-Peter


Am 10.02.25 um 16:41 schrieb Hans-Peter Sorge:
Hi,

A simple path to reproduce the reported ")Copy bug" :


     )clear
CLEAR WS
     )copy Editor
SAVED 2025-02-10 09:15:01 (GMT-6)
     E∆Edit 'E∆Edit'
 
At all prompts you can type 'end' to exit or backup to the previous question.
You can often type 'help' to get help.
 
Enter your edit command?  edit
Enter the line numbers you wish to change, or [a,b,r]?  2
SYNTAX ERROR
E∆Piv[18]  →(0=⍴t)/0
          ^^
     )reset
     →(0=⍴,0)/0
SYNTAX ERROR+
     →(0=⍴0)/0
     ^

The difference!!!    <⍴,0>  vs <⍴0>

Best Regards
Hans-Peter

Am 10.02.25 um 15:34 schrieb Blake McBride:
I just checked.  None of the problems I reported were corrected with this change.

Thanks.

Blake


On Mon, Feb 10, 2025 at 7:53 AM Dr. Jürgen Sauermann <mail@jürgen-sauermann.de> wrote:
Hi,

latest news: I have corrected an error in the ∇-editor. SVN 1833.

I am currently working on fixing a border case for function headers.
Not entirely stable yet. Your problem might be related to specific
function header cases.

Best Regards,
Jürgen


On 2/10/25 13:55, Dr. Jürgen Sauermann wrote:
Hi,

I am definitely not arguing that the problem is outside GNU APL. However,
it is very difficult for me to troubleshoot a problem that only occurs in the context
of a workspace that I am not familiar with. So please help to simplify the issue
to a smaller size.

Thanks,
Jürgen


On 2/9/25 20:09, Blake McBride wrote:
In case I haven't been clear, as far as I can tell, all of the problems are with GNU APL and none are with the Editor code.  At some earlier date, this exact editor code worked fine under GNU APL.  The editor code hasn't changed but no longer works; as reported.

If errors in the editor are found, I am happy to correct them.

Thanks.

Blake


On Sun, Feb 9, 2025 at 12:22 PM Blake McBride <blake1024@gmail.com> wrote:
The help message should be printed by the first line of E∆Pim.  I checked it and the code is correct.  It just doesn't run.

If I cut/paste the code into GNU APL it works fine.  But it doesn't run inside a function.

Just FYI, this Editor WS was used in a production environment, on a daily basis, for years on other APL systems.  When moving it to GNU APL I had to type it in so typos are possible.  Other than typos, however, the code is solid.

Thanks.

Blake


On Sun, Feb 9, 2025 at 11:51 AM Blake McBride <blake1024@gmail.com> wrote:
Greetings,

I haven't been using GNU APL for a while - just because I had other things I needed to do.  Now, trying to debug this issue I am finding several issues.  Here is the first:

      )load Editor
SAVED 2025-02-09 10:13:37 (GMT-6)
      ⎕IO←0
      (⎕CR 'E∆Edit')[31;]
EN1:→(2↑bv←qq E∆Pim'Enter your edit command')/END,EN1                          
                             
      E∆Edit 'E∆Edit'
 
At all prompts you can type 'end' to exit or backup to the previous question.
You can often type 'help' to get help.
 
Enter your edit command?  help
Enter your edit command?  end
SYNTAX ERROR
E∆Edit[31]  →(2↑bv←qq E∆Pim 'Enter your edit command')/31 34
            ^^

1. It shouldn't show "31 34".  It should show "END,EN1".

2. Syntax error.  Really?  Where?

3.  When I typed 'help' it should have seen a help message.  I haven't traced this through because of the syntax error.

This code worked fine as-is when it was released.

I'll see what I can do with #3.

Thanks!

Blake


On Sun, Feb 9, 2025 at 10:07 AM Blake McBride <blake1024@gmail.com> wrote:
Hello,

I have been watching this thread.  My impression is that it is not my code but a bug in GNU APL.  If it is my code, I am very happy to fix it.  I will take a look.

Thanks.

Blake


On Sun, Feb 9, 2025 at 9:08 AM Dr. Jürgen Sauermann <mail@jürgen-sauermann.de> wrote:
Hi Paul,

maybe Blake has an idea. For me it is very difficult to fix
workspaces that were contributed by other users. For the
author of the workspace fixing problems is far more easy.

Best Regards,
Jürgen


On 2/8/25 19:48, Paul Rockwell wrote:
Unfortunately, I haven't been able to get this reproduced with anything simpler.  I can reliably reproduce this using Blake's APL Editor found here: https://github.com/blakemcbride/APLEditor

I don't believe it to be an error in the functions themselves. I can )LOAD the original workspace and "fix up" problematic functions that I know have thrown the syntax error in the past by simply opening and immediately closing the funcion (no other changes) with the ∇ editor. Things work fine after that. 

II )SAVE the workspace, and then )LOAD the saved copy, and the error re-appears. 

I've validated the variables in the offending statement each time the error appears. All appears normal - there's no syntax error apparent in the _expression_, so I have no idea why the interpreter is throwing an error. If the function/workspace had problems, to me it seems as a result of the )save,)load,)copy mechanisms. Only the ∇ editor gets me around the issue - ⎕FX ⎕CR 'function-name' does not. 

Any ideas on how I can help track this down?

- Paul


On Feb 8, 2025, at 11:34 AM, Dr. Jürgen Sauermann <mail@jürgen-sauermann.de> wrote:

Hi Paul,

that very much looks like an error in the Editor workspace, doesn't it?
Can you reproduce the fault in plain APL?

Best Regards,
Jürgen


On 2/6/25 19:14, Paul Rockwell wrote:
I've been seeing syntax errors being thrown on functions copied from another workspace. I've imported Blake McBride's APL editor from his GitHub site (linked to by the GNU APL Community pages). It seems to be reasonably up to date.

Once I have the workspace created containing the editor application, I )SAVE it. I then create a new workspace and )COPY the functions in the editor workspace into my current workspace. Then I attempt to use it to edit a function (an alternative to the ∇ editor).

What I see is that the copied editor function will fail with a syntax error on branch statements within the function:

      )copy Editor
SAVED 2025-01-19 15:03:52 (GMT-5)
      E∆Edit 'asd'

 

At all prompts you can type 'end' to exit or backup to the previous question.
You can often type 'help' to get help.

 

Enter the line numbers you wish to change, or [a,b,r]?  2
SYNTAX ERROR
E∆Piv[18]  →(0=⍴t)/0
           ^^

However, if you look at the variables involved, there should be nothing that should cause this syntax error

      t
2
      ⍴t
1
      0=⍴t
0
      0/0

      ⍴0/0
0

The strange thing about this is that if I open the offending function in the ∇ editor and save it (making no changes), the error goes away... at least for that function:

      )si
      ∇E∆Piv
[51] ∇
      E∆Edit 'asd'

 

At all prompts you can type 'end' to exit or backup to the previous question.
You can often type 'help' to get help.

 

Enter your edit command?  edit
Enter the line numbers you wish to change, or [a,b,r]?  2
24

Enter your edit command?  end
SYNTAX ERROR
E∆Edit[31]  →(2↑bv←qq E∆Pim 'Enter your edit command')/31 34
            ^^

      


As you can see, another function is exhibiting the same error. Like the E∆Piv function, opening the E∆Edit function seems to "fix"the issue.
What doesn't seem fix the issue is using ⎕CR and ⎕FX as an alternative to the ∇ editor.

      )reset
      ⎕FX ⎕CR 'E∆Edit'
E∆Edit
      E∆Edit 'asd'

 

At all prompts you can type 'end' to exit or backup to the previous question.
You can often type 'help' to get help.

 

Enter your edit command?  edit
Enter the line numbers you wish to change, or [a,b,r]?  2
24

Enter your edit command?  end
SYNTAX ERROR
E∆Edit[31]  →(2↑bv←qq E∆Pim 'Enter your edit command')/31 34
            ^^

As you can see, that didn't fix the problem. Now open E∆Edit with the ∇ editor and see what happens:

      )reset
      ∇E∆Edit 
[41] ∇
      E∆Edit 'asd'

 

At all prompts you can type 'end' to exit or backup to the previous question.
You can often type 'help' to get help.

 

Enter your edit command?  edit
Enter the line numbers you wish to change, or [a,b,r]?  2
24

Enter your edit command?  end


As I said, this is very strange behavior. I can work around it, but quite honestly it's a pain because I have no idea when the issue is going to crop up again.

- Paul Rockwell 










--
Mike Hall






reply via email to

[Prev in Thread] Current Thread [Next in Thread]