Basic Tokenizer

Back to General discussions forum

simonhugo     2023-03-04 15:17:38
User avatar

For the Basic Tokenizer

If the first line that commands parsing is:

1552 FOR L=0 TO 7

For me the tokenization should be nwwonwn

In any case, how can it be that the answer given as correct is: nwowowpwowowpwwonwwonwwonwwonwn

There are not that many tokens on that line.

And so with the rest

gardengnome     2023-03-04 15:44:25
User avatar

Your code is not quite correct. Just as an example, look at the following input:

1
IF S(X,Y)=-2 THEN PRINT"X*";

Your program produces wwpwpwpppnwe but it should be wwpwpwpoonwwqp.

simonhugo     2023-03-04 17:52:16
User avatar

Yes, of course, I have not said that my code is correct. If not, what the judge gives as correct does not seem so to me:

For the input I've tried (I've just made nly a try waiting to see the correct answer and debug my code from there). Two first lines of the 81 total:

81 1552 FOR L=0 TO 7 IF U=0 OR U=7 THEN Q=Q+1

what I am told is correct for them:

nwowowpwowowpwwonwwonwwonwwonwn nwwpwpwpoonwwpwpwpoonwwon

It doesn't fit me, I don't understand it.

simonhugo     2023-03-04 17:55:48
User avatar

oh, the lines do not appear divided, sorry, the 81 is the number of lines. The primer line ends wint 7. The second line begin wint "IF U"

simonhugo     2023-03-04 17:58:16
User avatar

Sorry again, for my bad English. What I have put before is what is checker shows as "Expected answer was:"

gardengnome     2023-03-04 18:11:39
User avatar

I checked the output for the "expected answer" by submitting a wrong answer. The expected answer shown looked okay in my test.

Are you sure you have copied the full text (there are scrollbars etc.)?

simonhugo     2023-03-04 18:47:49
User avatar

Yes. This is the complete "Expecte answer was"

nwowowpwowowpwwonwwonwwonwwonwn nwwpwpwpoonwwpwpwpoonwwon nwwonwwpwpwpoonwwowon nwwpwpwponwwnpwn nwq nwonpw nwwowonwwowonwwowonwn nwwpwpwn nwq nwpwpwpwwonwnwonpwwonwnpwonowpwwpwpp wwonwnpwwonwnpwwpwpwpoonwn wnpnpnpnpnpnponpnpnpnpnpnpnponpnponpn wwpnpoonwn wppwpnpowpnpponppwpnpowpnpponpon nwwpwpwponwwpwowponwwpwowpowpwowpwn wqpwpwpwowpwowpwwpwpwponwn wnpwqpwpqe nwpwpnppwpnpponpwwpwpnpowpnpponwn nwon woe ww nwwpwpwponwwqp wwpwpwponwwn nwwonwn nwowpwowpwowpwowpwowonpwn wpwpwpowpwpwppwpwpwponpwwpwowponwn nwqpwpwpwowpwow nwwpwpwponwwpwowponwwpwowponwn nwwpwwpnpoonwwqwpnppwpnpppwpnpoonpwn nwwpnppq wwonwnpwwonwnpwwpwwonwn nwowowpwowowpwwonwwonwwonwwonwn nwwonwwpwpwpon nwwpwpwponwwpwpwponwwon nwq nwwpwpwponwwpwowonpwowonponwwn wwpwqpwpwwpw wwe nwwpwpwpoonwwwoonwnwnpwowpwnpww wwpwpwponwwqp nwq wq nwwpwowponwwowon nwq nwpwqpw wwpnpqwpnppwpnpqwpnppwpnpppwpnpoon wpwpnppwpnppowpwpnppwpnpp wpwpw nwwpnponwwpwpnppwpnppoonpwn wpwqpw wwonwn nwpwpwpowpwn nwwpwpwpoonwwqp nwwpwwowpnpwwpnpowpwpnpowpwpnpowpwpnpowpwpnpow nwwpnppwpnpnppwoonpwpnpoon wwpwpwpoonwwwoonwnwnpwwoonwnwnpwnpww nwonpwon nwwonwwowon nwppwowponppwowponpon wwpwpwponwwqp wwpnpwpnpppwn nwpwwpwpwp wq nwn nwwoonwnwnpwwowonwwowonwwowonwn w wowpnppwowpnppwwpwpwpoonwwoonpwwoonwnwnpwn nwwonwn wpwpw nwwpwowpwowponwpwpwowpwowponwpwowowwwowowppwwowon wwpwpwpoonwwwoonwnwnpwwoonwnwnpwnpwwpw nwwpnppq nwwpwpwponwn nwwpwowpwowponwwowonpwn nwowowpwowowpwwonwwonwwonwwonwn wq w wn nwwoe nwwpw nwwpwpwpoonwwqp wwonwwonwwowon nwqpwpwpwwonwn wwwwwe nwwonwn

and this is my incorrect, response

nwwonwn wwonwwonwwowon wwpwpwpoonwwpwowpoonwwpwowpoonwn nwq ww wq nwpwqpw wpwwpwpwp nwwpnpwpnpppwn nwwpnponwwpwpnppwpnppoonpwn nwnpwqpwpqe nwwpwpwpoonwwpwpwpoonwwon nww nwwpwpwn nwq wpwpwpowpwpwppwpwpwponpwwpwowpoonwn wwwwe nwpwpwpowpwn wpwpw nwwpwpwpoonwwwoonwnwnpwwoonwnwnpwnpww nwq nwowowpwowowpwwonwwonwwonwwonwn wwonwwowon wwpwowpwowponwpwpwowpwowponwpwowowwwowowppwwowon wwpwpwpoonwe nwwonwn wwopn nwwpwpwponwe nwwpwpwponwn nwqpwpwpwowpwow wwpwowponwwowon nwpwpnppwpnpponpwwpwpnpowpnppoonwn wwonwnpwwonwnpwwpwwonwn nwq nwwpwowpwowponwwowonpwn nwwpwpwpoonwe nwwpwpwponwwpwowponwwpwowpowpwowpwn nwonpw wwpwpwponwe won nwwpnpqwpnppwpnpqwpnppwpnpppwpnpoon nwwonwwpwpwpoonwwowon wwpwpwpoonwwwoonwnwnpwowpwnpww nwn nwwpwpwponwwnpwn nwq wpwqpw nwwoonwn nwqpwpwpwowpwowpwwpwpwponwn nwwoonwnwnpwwowonwwowonwwowonwn nwwowonwwowonwwowonwn nwpwpnppwpnppowpwpnppwpnpp nwowpwowpwowpwowpwowonpwn wwonwnpwwonwnpwwpwpwpoonwn nwwpwpwpoonwwwoonwnwnpwwoonwnwnpwnpwwpw wwpnppq wppwpnpowpnpponppwpnpowpnpponpon nwqpwpwpwwonwn nwowowpwowowpwwonwwonwwonwwonwn nwwpwpwponwe nw wq wwoonwn nwowpnppwowpnppwwpwpwpoonwwoonpwwoonwnwnpwn nwowowpwowowpwwonwwonwwonwwonwn nwwpnppq nwwpwpwponwwpwpwponwwon wwpnpoonwn nwwpwpwponwwpwowonpwowonponwwn nwn nw wq nwonpwon wpwpwpwwonwnwonpwwonwnpwonowpwwpwpp nwwpwwowpnpwwpnpowpwpnpowpwpnpowpwpnpowpwpnpow nwq wwpe nwpwpw wwpnppwpnpnppwoonpwpnpoon wwpw nwoe

T

gardengnome     2023-03-04 19:23:03
User avatar

The word count does not match, and the token types are completely different. Either there is a strange bug, or you submitted the results for a different (old?) set of inputs.

simonhugo     2023-03-05 11:27:54
User avatar

Something like that must have been, the successive attempts did give me coherent answers.

thank you gardengnome

Please login and solve 5 problems to be able to post at forum