get unused integer



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
.



Relevant Pages

  • Re: [ Attn: Randy ] Ad-hoc Parsing?
    ... written with Beth's syntax using any of the standard parsing ... With a common parsing techniques, ... into tokens using something akin to RegExps ie. the sentence ... [LABEL, OPEN_BRACKET, LABEL, CLOSE_BRACKET, COLON]. ...
    (alt.lang.asm)
  • Re: pack+grid frame vs. (BWidget) LabelFrame
    ... label .f.l1 -text bla ... label .f.l2 -text bli ... You are aware that Tk has a native labelframe widget that does work ...
    (comp.lang.tcl)
  • pack+grid frame vs. (BWidget) LabelFrame
    ... label .f.l1 -text bla ... label .f.l2 -text bli ... "Whenever there is a conflict between human rights and property ...
    (comp.lang.tcl)