Page 1 of 1

Crash in stdIo::write/0...

Posted: 11 Sep 2013 16:28
by Martin Meyer
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

Posted: 11 Sep 2013 18:07
by Thomas Linder Puls
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).

Posted: 12 Sep 2013 17:22
by Martin Meyer
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).

Posted: 13 Sep 2013 8:18
by Thomas Linder Puls
OK.