Re: [eclipse-clp-users] Newbie Q: using an exported struct ....

From: Joachim Schimpf <jschimpf_at_...311...>
Date: Fri, 08 Feb 2013 17:55:23 +0000
On 08/02/2013 15:09, Basile Starynkevitch wrote:
...
> I can't figure out how to use exported structures. To be precise,
>
> file lexer.ecl contains
>     :- export struct(tKeyw(loc,word)).
>
> file parser.ecl contains
>
>     :- use_module(lexer).
> then later
>
> parseProgram(FileName,[Tprog|TokensAfterProg],
> 	     pProgram(Clas,Vars,SeqInsts,FileName,StartLine,EndLine),
> 	     [])
> :-
>      parseToken(Tprog,tKeyw{loc:StartLine,word:program}),
>      parseClassList(FileName, TokensAfterProg, Classes, TokensAfterClassList),
>      parseLocals(FileName,TokensAfterClassList, Vars, TokensAfterLocals),
>      parseSeq(FileName,TokensAfterLocals,SeqInsts,[])
> .
>
>
> And Eclispe is unhappy with the above, giving
> WARNING: Unrecognized structure name in module parser in
>      tKeyw{loc : StartLine, word : program}
>
> I cannot understand why! ???


Hi Basile,

The problem is here:
>
> :- use_module(library(pretty_print)).
> :- use_module(lexer).
>
> :- module(parser).

The use_module directives must be _inside_ the module, i.e.
after the module-directive.  There should never be anything
before a module-directive.  If you exchange the order, that
fixes your problem.

If you do that, then you also don't need all the explicit
module-qualifications (like pretty_print:pretty_print(...))
that I see in your code.


-- Joachim
Received on Fri Feb 08 2013 - 17:55:34 CET

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST