** memory layout **
* *itit~it_C
* *itit~it__m
* *itit~itfbs_c
*
* *: a sentinel ( minus 1 )
* i: stacked if(condition) clause ( 1 for true 2 for false )
* t: stacked then clause ( 1 for true 2 for false )
* C: the first character of "if" or "true" or "false"
* m: 4 minus (C plus 1) mod 4
* f: temporary flag
* b: current true/false value ( 1 for true 2 for false )
* s: skip flag ( to skip "then" or "else" )
* c: continue flag
**
*loop(line)*
- > , + [
*loop(token)*
[
*analyze the first character ( mod 4 )*
C [ > [ - >> ] < [ > +++ > ] << - ]
>> + < m - [ - [ -
*t(true)* > ,,, [ - ] < b + > ] >
[ *i(if)* , [ - ] >>>> c + < ] < ] >
[ *f(false)* ,,,, [ - ] < b ++ >> ]
<< b [ > s [ - ] <
< f + < + [ - < i [ > t [
* move b ( the newest "else" clause ) as the new b *
< i - [ - > t [ - ] > f - > b [ - << + >> ] b < ] >>
* move the newest "then" clause as the new b *
[ f - > b [ - ] > ] << f * *itit_b! ] >
* fill the "then" clause *
[ f - > [ - << + >> ] >> ] * *itit_b_! or *itit___! * ] >>
* fill the "if(condition)" clause *
[ f - > [ - <<< + >>> ] >>>> ] * *itit_b___! or *itit_____! or itiT_____! *
<<< s + > ]
> f [ *print*
+++++ [ - << ++ < + < +++ < ++++ [ +++++++++++++++ > ] > ]
> - [ *false* - << - < . < + . < . < + . >>> - . >> ] < +
[ *true* - <<<<< ++ . -- . +++ . >>> - . > ]
,. [[ - ] < ] * a newline from stdin *
] * *itit_bs_! or null *
<<< b ]
* *itit_!__c or *itit_!s__ or nothing *
* skip "then" or "else" and input the first character of the next token *
> s [ - >> c ,,,,, << ] >> c [[ - ] <<<< ,, + >> ]
<< ]
- > , + ]
KiogbWVtb3J5IGxheW91dCAqKgoqICppdGl0fml0X0MKKiAqaXRpdH5pdF9fbQoqICppdGl0fml0ZmJzX2MKKgoqICo6IGEgc2VudGluZWwgKCBtaW51cyAxICkKKiBpOiBzdGFja2VkIGlmKGNvbmRpdGlvbikgY2xhdXNlICggMSBmb3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wgdGhlICJpZihjb25kaXRpb24pIiBjbGF1c2UgKgogICAgW2YtPlstPDw8Kz4+Pl0+Pj4+XSAqICppdGl0X2JfX18hIG9yICppdGl0X19fX18hIG9yIGl0aVRfX19fXyEgKgogICA8PDxzKz5dCiAgID5mWypwcmludCoKICAgICsrKysrWy08PCsrPCs8KysrPCsrKytbKysrKysrKysrKysrKysrPl0+XQogICAgPi1bKmZhbHNlKiAtPDwtPC48Ky48LjwrLj4+Pi0uPj5dPCsKICAgIFsgICp0cnVlKiAtPDw8PDwrKy4tLS4rKysuPj4+LS4+XQogICAgLC5bWy1dPF0gKiBhIG5ld2xpbmUgZnJvbSBzdGRpbiAqCiAgIF0gKiAqaXRpdF9ic18hIG9yIG51bGwgKgogIDw8PGJdCiAgKiAqaXRpdF8hX19jIG9yICppdGl0XyFzX18gb3Igbm90aGluZyAqCiAgKiBza2lwICJ0aGVuIiBvciAiZWxzZSIgYW5kIGlucHV0IHRoZSBmaXJzdCBjaGFyYWN0ZXIgb2YgdGhlIG5leHQgdG9rZW4gKgogID5zWy0+PmMsLCwsLDw8XT4+Y1tbLV08PDw8LCwrPj5dCiA8PF0KLT4sK10=
stdin
dHJ1ZQpmYWxzZQppZiB0cnVlIHRoZW4gZmFsc2UgZWxzZSB0cnVlCmlmIGZhbHNlIHRoZW4gZmFsc2UgZWxzZSB0cnVlCmlmIGlmIHRydWUgdGhlbiBmYWxzZSBlbHNlIGZhbHNlIHRoZW4gdHJ1ZSBlbHNlIGZhbHNlCmlmIGlmIHRydWUgdGhlbiB0cnVlIGVsc2UgZmFsc2UgdGhlbiB0cnVlIGVsc2UgZmFsc2UKaWYgaWYgaWYgdHJ1ZSB0aGVuIHRydWUgZWxzZSB0cnVlIHRoZW4gdHJ1ZSBlbHNlIHRydWUgdGhlbiB0cnVlIGVsc2UgdHJ1ZQo=
true
false
if true then false else true
if false then false else true
if if true then false else false then true else false
if if true then true else false then true else false
if if if true then true else true then true else true then true else true