Re: [Chicken-users] odd compiler messages on program structure errors

2017-10-08 Thread dan
FWIW, I find that the stack traces shown by Chicken’s parser often seem wholly 
unrelated to the code at the source of the error. I’m not sure why, either.

 

-Dan

 

From: Chicken-users [mailto:chicken-users-bounces+dan=ironoxide...@nongnu.org] 
On Behalf Of Claude Marinier
Sent: October 8, 2017 10:35 AM
To: chicken-users <chicken-users@nongnu.org>
Subject: Re: [Chicken-users] odd compiler messages on program structure errors

 

Allô,

 

On 7 October 2017 at 16:50, <claudem...@gmail.com <mailto:claudem...@gmail.com> 
> wrote:
> An extra pair of parentheses can cause "interesting" behaviour.

It was a double left parenthesis before a 'let'. Just a typo. My friend 'vim'
helped me balance the parentheses and everything looked good. So Chicken
evaluated the result of the 'let' which, oddly, was OK a lot of the time. That
was quite a detective adventure.

> After fixing the bug, I commented out extra display statements. I was too
> hasty and took out more than I should have thereby changing the structure
> of the code (removed some parentheses). The compiler (v4.12.0 Linux 64-bit)
> produced error messages with line numbers inside numbers.scm; this is odd.

I am now able to reproduce the problem. I made a copy of the working code and
reversed the changes I made to correct the problem I introduced earlier.

csc -d1 -O3 -X numbers-syntax -deploy -prologue prologue.scm -R numbers
  -R linenoise -o testing testing.scm

Error: (line 1913) unexpected list terminator: #\)

Call history:

numbers.scm:1671: scan-ureal  
numbers.scm:1603: scan-digits+hashes  
numbers.scm:1549: scan-digits 
numbers.scm:1531: lp  
numbers.scm:1548: g1937   
numbers.scm:1720: %string->compnum
numbers.scm:1672: scan-real   
numbers.scm:1671: scan-ureal  
numbers.scm:1603: scan-digits+hashes  
numbers.scm:1549: scan-digits 
numbers.scm:1531: lp  
numbers.scm:1548: g1937   
numbers.scm:1720: %string->compnum
numbers.scm:1672: scan-real   
numbers.scm:1720: %string->compnum
numbers.scm:1672: scan-real <--

Error: shell command terminated with non-zero exit status 17920:
'/usr/local/bin/chicken' 'testing.scm' -output-file 'testing.c' -debug-level 1
-optimize-level 3 -extend numbers-syntax -prologue prologue.scm
-require-extension numbers -require-extension linenoise

The line identified in the error message looks like this - 1913 is marked
with the "->". The last two right parentheses are superfluous.

  (else
; not a recognized token, could be a parser error,
; handled at the caller
->  token
 
The call history seems unrelated to the error.

Is that enough information to guess at the underlying problem?

Merci.


-- 

Claude Marinier

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] odd compiler messages on program structure errors

2017-10-08 Thread Claude Marinier
Allô,

On 7 October 2017 at 16:50,  wrote:
> An extra pair of parentheses can cause "interesting" behaviour.

It was a double left parenthesis before a 'let'. Just a typo. My friend
'vim'
helped me balance the parentheses and everything looked good. So Chicken
evaluated the result of the 'let' which, oddly, was OK a lot of the time.
That
was quite a detective adventure.

> After fixing the bug, I commented out extra display statements. I was too
> hasty and took out more than I should have thereby changing the structure
> of the code (removed some parentheses). The compiler (v4.12.0 Linux
64-bit)
> produced error messages with line numbers inside numbers.scm; this is odd.

I am now able to reproduce the problem. I made a copy of the working code
and
reversed the changes I made to correct the problem I introduced earlier.

csc -d1 -O3 -X numbers-syntax -deploy -prologue prologue.scm -R numbers
  -R linenoise -o testing testing.scm

Error: (line 1913) unexpected list terminator: #\)

Call history:

numbers.scm:1671: scan-ureal
numbers.scm:1603: scan-digits+hashes
numbers.scm:1549: scan-digits
numbers.scm:1531: lp
numbers.scm:1548: g1937
numbers.scm:1720: %string->compnum
numbers.scm:1672: scan-real
numbers.scm:1671: scan-ureal
numbers.scm:1603: scan-digits+hashes
numbers.scm:1549: scan-digits
numbers.scm:1531: lp
numbers.scm:1548: g1937
numbers.scm:1720: %string->compnum
numbers.scm:1672: scan-real
numbers.scm:1720: %string->compnum
numbers.scm:1672: scan-real <--

Error: shell command terminated with non-zero exit status 17920:
'/usr/local/bin/chicken' 'testing.scm' -output-file 'testing.c'
-debug-level 1
-optimize-level 3 -extend numbers-syntax -prologue prologue.scm
-require-extension numbers -require-extension linenoise

The line identified in the error message looks like this - 1913 is marked
with the "->". The last two right parentheses are superfluous.

  (else
; not a recognized token, could be a parser error,
; handled at the caller
->  token

The call history seems unrelated to the error.

Is that enough information to guess at the underlying problem?

Merci.

-- 
Claude Marinier
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] odd compiler messages on program structure errors

2017-10-08 Thread Jörg F . Wittenberger

Hello Claude,

On Oct 7 2017, Claude Marinier wrote:


Good afternoon,

Things are good.


Great to hear.


...
I either get "unterminated list" or "unexpected list terminator: #\)". I
realize too late that I should have made a copy of the failing code. Sorry.

So, should we be concerned about this?


Yes we should.  I some way or another.

Unbalanced parenthesis however are a very basic syntx violation in any 
LISP. Adding in that the syntax is extensible, it is exceptionally hard to 
do something reasonable about the situation.


Some favor "readable LISP" like SRFI's 110 and 119 - both of which infer 
missing list terminators from changes in intentiation.


But many LISPers use emacs and - having been burned by the phenomenom early 
in their carrers - developed a habbit to always insert/delete them in 
corresponding pairs and have their editor indent automatically. Once 
accustomed to this style, they often prefer this over manually figuring out 
how much text they actually need to mark for edits.


In the end of the day, misplaced delimiters happen. They are nasty. I'm 
among those who accepted the occational pain.


Best

/Jörg




___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] odd compiler messages on program structure errors

2017-10-07 Thread Claude Marinier
Good afternoon,

Things are good. It's Thanksgiving weekend (shorter growing season here in
Canada) and I found & fixed a tough bug yesterday. An extra pair of
parentheses can cause "interesting" behaviour.

After fixing the bug, I commented out extra display statements. I was too
hasty and took out more than I should have thereby changing the structure
of the code (removed some parentheses). The compiler (v4.12.0 Linux 64-bit)
produced error messages with line numbers inside numbers.scm; this is odd.

The Question

Does 'csc' have a hard time with unclosed parentheses? Is this a known
problem? Should we respond to those kinds of errors by concluding the
program is missing a parenthesis?

I am unable to recreate the failing code in the program in question. Quick
tests with smaller programs do not reproduce the odd error messages. I
either get "unterminated list" or "unexpected list terminator: #\)". I
realize too late that I should have made a copy of the failing code. Sorry.

So, should we be concerned about this?

Thank you.

-- 
Claude Marinier
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users