get unused integer
- From: Simon Strobl <Simon.Strobl@xxxxxxxxx>
- Date: Fri, 16 May 2008 07:58:33 -0700 (PDT)
Hello,
in a parsing procedure, I need to assign labels to certain tokens
(under certain circumstances, i.e. NOT each time a rule is applied).
No two tokens must get the same label. A new label should be assigned
like in
(1) NewLabel is OldLabel + 1
I think I cannot simply use a label argument in grammar rules, as
shown below:
(2) s(Bla, Bli, Label, T1, T3) :-
NPLabel is Label + 1,
VPLabel is Label + 2,
np(Bla, Bli, NPLabel, T1, T2),
vp(Bla, Bli, VPLabel, T2, T3).
Apart from not satisfying condition (1), this strategy and similar
strategies will not make sure that no label is used twice.
I do not want to use global variables nor any technique that is
probable to be in the way when the program uses multiple threads.
How can this problem be solved?
Simon
.
- Follow-Ups:
- Re: get unused integer
- From: Christian Theil Have
- Re: get unused integer
- Prev by Date: Re: prolog reading a file the ISO style
- Next by Date: Re: why not use LISP-imp of Prolog as opposed to Prolog itself?
- Previous by thread: Discriminating facts from rules
- Next by thread: Re: get unused integer
- Index(es):
Relevant Pages
|