[m-users.] Uncaught mercury exception using try []

Sean Charles (emacstheviking) objitsu at gmail.com
Fri May 28 05:44:20 AEST 2021


For want of any reason other than it’s easy I have decided to raise an exception during my ast parsing, I don’t know how deep down or where I may be when trouble is detected and so it seems like the quickest way out; for my application I don’t need to attempt a restart, it’s game over at that point.

Here is my simple try block

on_lexer(Lx, AST) :-
    AST = astcon,
    list.filter_map(promote, lexer.tokens(Lx), ATokens),
    atrace("after promotion: %s\n\n--", [s(string(ATokens))]),
    (
        try []
            ast([], Tree, ATokens, Rest)
        then
            atrace("then block, Rest: %s\n", [s(string(Rest))])
        else
            atrace("else block\n", [])
        catch syntax_error(Pos, Why) ->
            atrace("oops: %s at %s", [s(Why), s(string(Pos))])
    ).

and the compiler error seems to be in the C code not the mercury code,

mmc -s hlc.gc -O4 -E -ledit --make felt
Making Mercury/int3s/ast.int3
Making Mercury/ints/ast.int
Making Mercury/cs/ast.c
Uncaught Mercury exception:
Software Error: predicate `check_hlds.try_expand.extract_intermediate_goal_parts'/7: Unexpected: unexpected goal form
** Error making `Mercury/cs/ast.c'.
make: *** [felt] Error 1
The terminal process "/bin/zsh '-c', 'make -f Makefile'" terminated with exit code: 2.

And I have no idea what I did to upset it now how to proceed. I searched for ‘try []’ in the source distribution to get some examples and then went for it.

Thanks
Sean

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20210527/49cb50f3/attachment.html>


More information about the users mailing list