Re: Found bugs in PAKCS show

From: Björn Peemöller <bjp_at_informatik.uni-kiel.de>
Date: Mon, 26 Jan 2015 09:42:50 +0100

Hi Andy,

> [1] Characters \v \f
>
> These characters appear as \v -> \011 and \f -> \012. In fact, 11 and
> 12 are the correct **decimal** representations of those numbers, but
> with the leading ‘0’ they are presented as octal.

This representation is correct, although it may be misleading. While in
some other languages like C a leading 0 indicates an octal encoding of
the literal, this in not true for Curry (and Haskell as well).

Here, leading zeros do not affect the value of the literal:

$ ghci
GHCi, version 7.10.0.20141222: http://www.haskell.org/ghc/ :? for help
Prelude> '\00012'
'\f'

To achieve an octal representation, the literal has to start with either
0o or 0O, in analogy to 0x or 0X for hexadecimal numbers.

> [2] Single quotes are escaped inside of double-quoted strings. Doing
> this the once is OK, since the single quote is interpreted the same way
> whether it is escaped or not. But if show is applied multiple times,
> the extra backslash is further escaped, causing an incorrect result.

This is indeed an error in the show function, thank you for the bug
report. While reproducing your error, I also stumpled upon another
encoding error.

[3] Character literals whose numeric value exceeds 999 are not
represented correctly:

Prelude> '\999'
'\999'
Prelude> '\1000'
'\:00'
Prelude> '\:00'

PAKCS_Main_Exp.curry, line 1.18:
    Illegal escape sequence
ERROR occurred during parsing!

I did not check if these are reasonable characters, but the error also
occurs for the Unicode ellipsis character '\8230'.

Kind regards,
Björn
_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry

Received on Mo Jan 26 2015 - 23:49:04 CET

This archive was generated by hypermail 2.3.0 : Do Feb 01 2024 - 07:15:11 CET