Crash in stdIo::write/0...

Discussions related to Visual Prolog
Martin Meyer
VIP Member
Posts: 280
Joined: 14 Nov 2002 0:01

Crash in stdIo::write/0...

Unread post by Martin Meyer » 11 Sep 2013 16:28

Hello Thomas, hi all,

when I create a new "console application"-project (in VIP 7.4 build 7402) and put following code to main.pro

Code: Select all

interface grammar{@Terminal}       domains         parseTree = parseTree(             symbol Nonterminal,             argumentParseTree* ArgParseTreeList).         argumentParseTree =             argParseTree(parseTree);             argTerminal(@Terminal).   end interface grammar   %------------   implement main       open grammar{string}   clauses     run():-         console::init(),         ParseTree = parseTree("verum", [argTerminal("true")]),         stdIo::write(ParseTree).   end implement main   goal     mainExe::run(main::run).
then the call to stdIo::write/0... throws an access violation. Probably it's a bug?

Many regards,
Martin

User avatar
Thomas Linder Puls
VIP Member
Posts: 1176
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 11 Sep 2013 18:07

Yes, that is a bug. We will look at it.

A work around could be to use an ordinary polymorphic domain instead:

Code: Select all

interface grammar{@Terminal}   domains     parseTree{T} = parseTree(         symbol Nonterminal,         argumentParseTree{T}* ArgParseTreeList).     argumentParseTree{T} =         argParseTree(parseTree{T});         argTerminal(T).   predicates     printGrammar : (parseTree{@Terminal} Grammar).   end interface grammar
I.e. the domain uses a normal type parameter, but in the predicate declaration(s) you will instantiate the domain with the interface parameter (i.e. @Terminal).
Regards Thomas Linder Puls
PDC

Martin Meyer
VIP Member
Posts: 280
Joined: 14 Nov 2002 0:01

Unread post by Martin Meyer » 12 Sep 2013 17:22

Maybe the origin of the problem is not in stdIo::write/0..., because with my type declaration (not with your work around) the compiler complaines about type incompatibility in

Code: Select all

        ParseTree = parseTree("verum", [argTerminal("true")]),         _ = toBoolean(ParseTree = ParseTree).

User avatar
Thomas Linder Puls
VIP Member
Posts: 1176
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 13 Sep 2013 8:18

OK.
Regards Thomas Linder Puls
PDC

Post Reply