On Wed, Feb 19, 2020 at 12:09:52PM +0100, Ralf Hemmecke wrote:
> Can somebody tell me why the attached program does not compile?
> 
> The error message looks not very helpful.
> 
> Is that a bug?
> 
> Ralf
> 
> (1) -> )co bug.spad
>    Compiling FriCAS source code from file
>       /home/hemmecke/backup/git/qeta/src/bug.spad using old system
>       compiler.
>    FOO abbreviates domain Foo
> ------------------------------------------------------------------------
>    initializing NRLIB FOO for Foo
>    compiling into NRLIB FOO
>    compiling exported foo : () -> Boolean
> ****** comp fails at level 3 with expression: ******
> error in function foo
> 
> (SEQ (|:=| (|:| |a| (|List| (|List| (|Integer|)))) (|empty|))
>      (|:=| (|:| |b| (|List| (|List| (|Integer|)))) (|empty|))
>      (|exit| 1 | << | (< |a| |b|) | >> |))
                         ^^^^^^^^^

This tells you that offending part is

        a < b

> ****** level 3  ******
> $x:= (< a b)
> $m:= (Boolean)
> $f:=
> ((((|b| # #) (|a| # #) (|foo| #) (|$DomainsInScope| # # #) ...)))
> 
>    >> Apparent user error:
>    not known that (List (List (Integer))) has (AND (has (List (List
> (Integer))) (finiteAggregate)) (has (List (Integer)) (OrderedSet)))
                                                        ^^^^^^^^^^^

This is compiler's way of saying that it does not have ordering
predicate for List(List(Integer)).  A would say that this
message is better than average -- not to say that it is good
but that generally we should think about improving error
messages.  OTOH given information that compiler has (it does
not know about user input), it is hard to do better.

OK, one thing that we should do is to track offending expression
back to user input.  With current compiler this is essentially
unsolvable problem.  It would be easy with different compiler
structure.  More precisely, every subexpression should have
attached "birth certificate", that is info about original
location in source.  From one point of view this is trivial,
but essentially requires complete compiler rewrite.

Another thing is wording of error messages.  If you have
proposals for better wording I would like to hear them.

And, BTW what you think about interpreter error messages?
In a sense interpreter uses more advaned approach, for example
it says you at which place it thinks that syntax error
happended (but also interpretes looses info about source
locations when dealing with type errors).  This is relevant
as I would like to unify interpeter with Spad compiler,
hopefuly preserving good features of both.

-- 
                              Waldek Hebisch

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/20200219134250.GA20336%40math.uni.wroc.pl.

Reply via email to