zimmski / tavor

A generic fuzzing and delta-debugging framework
MIT License
245 stars 10 forks source link

Forward referencing does not really work anymore #98

Open zimmski opened 7 years ago

zimmski commented 7 years ago
$Even Sequence = start: 0,
                  step: 2

START = A

A = "The first " $B.Count " even Integers are:" B

B = +4,10($Even.Next " ")

results into the internal structure

(0xc4200e4d80)&lists.Concatenation{tokens:[]token.Token{(*sequences.SequenceResetItem)(0xc4200960e0), (*primitives.Scope)(0xc42010f040)}}
        (0xc4200960e0)&sequences.SequenceResetItem{sequence:(*sequences.Sequence)(0xc4200e4ae0)}                     
        (0xc42010f040)&primitives.Scope{token:(*lists.Concatenation)(0xc4200e4f00)}                                  
                (0xc4200e4f00)&lists.Concatenation{tokens:[]token.Token{(*primitives.ConstantString)(0xc42010f020), (*aggregates.Len)(0xc42010f060), (*primitives.ConstantString)(0xc42010f030), (*aggregates.Len)(0xc42010f070)}}
                        (0xc42010f020)&primitives.ConstantString{value:"The first "}                                 
                        (0xc42010f060)&aggregates.Len{token:(*lists.Repeat)(0xc420108380)}                           
                        (0xc42010f030)&primitives.ConstantString{value:" even Integers are:"}                        
                        (0xc42010f070)&aggregates.Len{token:(*lists.Repeat)(0xc420108380)} 

Which is wrong because the last token in the output should be "B" which is a repeater.

$Even Sequence = start: 0,
                  step: 2

START = A

A = B "The first " $B.Count " even Integers are:" B

B = +4,10($Even.Next " ")

Does not work at all

tavor --print-internal --format-file blub.tavor                                                 
cannot parse tavor file: L:6, C:23 - unknown token attribute "Count" for token type "*primitives.Pointer"

On the other hand, the following works:

$Even Sequence = start: 0,
                  step: 2

B = +4,10($Even.Next " ")
A = "The first " $B.Count " even Integers are:" B

START = A

So there is clearly something wrong with the current implementation.