Stck:0 0 NEWCLAUSE
?Stck:0 8 CREATE "TREST"
?Stck:1 24 PUSH "() trial 1"
?Stck:2 48 COPY "() trial 1"
Stck:0 56 NEWCLAUSE
?Stck:0 64 PUSH "test of () trial 1"
?Stck:1 88 SAY "test of () trial 1"
Stck:0 96 NEWCLAUSE
?Stck:0 104 CREATE "S"
?Stck:1 120 LOAD "TREST"
?Stck:2 144 CALL DOTELL NoArgs=1, Exist=1 Type=other
?Stck:2 248 LOADARG "() trial 1"
?Stck:3 264 COPY2TMP "() trial 1"
?Stck:3 272 PARSE "() trial 1"
?Stck:3 280 PUSH "("
?Stck:4 304 TR_LIT "("
// TR_LIT is trying to set break_end to a reasonable value based on the literal position
DBG> tr_lit: ToParse='() trial 1' - Lit='('
DBG> tr_lit exit) data_start = 1
DBG> tr_lit exit) break_start = 1
DBG> tr_lit exit) break_end = 2
?Stck:3 312 CREATE "WITH"
?Stck:4 328 PVAR
// Here you can see, that the "WITH" keyword is handled as variable, not as keyword.
// "WITH" keyword is not allowed at this context.
DBG> OP_PVAR: BreakStart: 1
DBG> OP_PVAR: BreakEnd: 2
DBG> OP_PVAR: DataStart: 1
DBG> OP_PVAR: DataEnd: 1
?Stck:3 344 TR_SPACE
DBG> tr_space 1) data_start = 1
DBG> tr_space 1) break_start = 1
DBG> tr_space 1) break_end = 2
DBG> tr_space 2) data_start = 2
DBG> tr_space 2) break_start = 3
DBG> tr_space 2) break_end = 4
?Stck:3 352 CREATE "IN1"
?Stck:4 368 PVAR
// OP_PVAR operation will extract a value from the parse string into the in1 variable
DBG> OP_PVAR: BreakStart: 3
DBG> OP_PVAR: BreakEnd: 4
DBG> OP_PVAR: DataStart: 2
DBG> OP_PVAR: DataEnd: 3
DBG> OP_PVAR: extracting value from '() trial 1' ?(2 to 3)
?Stck:3 384 PUSH ")"
?Stck:4 408 TR_LIT ")"
// TR_LIT is trying to set break_end to a reasonable value based on the literal position
DBG> tr_lit: ToParse='() trial 1' - Lit=')'
DBG> tr_lit 1) pattern_pos = 0
DBG> tr_lit 2) data_start = 4
DBG> tr_lit 2) break_start = 11
DBG> tr_lit 2) break_end = 11
?Stck:3 416 CREATE "IN2"
?Stck:4 432 PVAR
// OP_PVAR operation will extract a value from the parse string into the in2 variablev
DBG> OP_PVAR: BreakStart: 11
DBG> OP_PVAR: BreakEnd: 11
DBG> OP_PVAR: DataStart: 4
DBG> OP_PVAR: DataEnd: 11
DBG> OP_PVAR: extracting value from '() trial 1' ?(4 to 11)
?Stck:3 448 TR_END
?Stck:3 456 CREATE "OUTER"
?Stck:4 472 PVAR
// OP_PVAR operation will extract a value from the parse string into the outer variable
DBG> OP_PVAR: BreakStart: 11
DBG> OP_PVAR: BreakEnd: 11
DBG> OP_PVAR: DataStart: 11
DBG> OP_PVAR: DataEnd: 11
?Stck:3 488 POP
Stck:2 504 NEWCLAUSE
?...
?...
?
So, the compiler puts the template on the stack with the information that there must be two variables between two literals.?
The interpreter knows now, which operations (TR_LIT and TR_SPACE and PVALUE) must be executed,?
in order to bring the values from the input string into the variables. Unfortunately, the parsing algorithm cannot handle?
this, if the number of expected variables does not match the "words" in the input string.
To bring it to the point. The compiler, which unfortunately also processes its instructions sequentially,?
would have to collect all literals first, and only then place the template on the stack.?
Then one would have the possibility in the interpreter to process the data, as you described it.
If this makes any sense to you. :)