4 ms·
I thought I could follow at least some of the unobsfucated C, and then this monstrosity: t = "++#m--%am*@R<^1c/@%[_[H3c%@%[_[H3c+@.B#d-@%:_^BKd<<Z/03e>>`/0
by vermilingua 6y ago
I thought I could follow at least some of the unobsfucated C, and then this monstrosity:
t = "++#m--%am*@R<^1c/@%[_[H3c%@%[_[H3c+@.B#d-@%:_^BKd<<Z/03e>>`/03e<=0f>=/f<@.f>@1f==&g!=\'g&&k||#l&@.BCh^@.BSi|@.B+j~@/%Yd!@&d*@b";
Could someone please explain what is going on in that routine?
- jedisct1 6y agoLooks like a type definition in Rust.
- neilalexander 6y agoThis made me smile :-)
- scoutt 6y agoIf it doesn't end with .unwrap() then it isn't Rust.
- cztomsik 6y agotrue :(
- bombcar 6y agoT is being assigned a string value that looks like line noise. I assume it's Perl.
- hu3 6y agoHaha. Thanks I needed that Monday morning laugh.
- userbinator 6y agoIt's funny to see the Perl comparison when APL-family languages normally have code that looks like that: https://github.com/Co-dfns/Co-dfns/tree/master/cmp https://github.com/Co-dfns/Co-dfns/tree/master/cmp
- johnisgood 6y agoRust is more unreadable to me than Perl, in all fairness.
- eimrine 6y agoI would like to look at the code after preprocessing, it is too hard to analyze the code with all those #define statements.
- edflsafoiewq 6y agoBased on the unobfuscated source, this is a lookup table of some kind for operators, encoded in a string. ++ -> tokl=11 tokc=0x1 -- -> tokl=11 tokc=0xff * -> tokl=1 tokc=0xc1af / -> tokl=1 tokc=0xf9f7 % -> tokl=1 tokc=0xf9f7 + -> tokl=2 tokc=0xc801 - -> tokl=2 tokc=0xd8f7 << -> tokl=3 tokc=0xe0d3 >> -> tokl=3 tokc=0xf8d3 ... ! -> tokl=2 tokc=0x4 * -> tokl=0 tokc=0x0 For example *@R<^1c ^^ operator (padded with @ when one character) ^^^^ tokc (variable length) ^ tokl
- xashor 6y agoIt's part of the tokenizer. t contains data in the format of [char 0][char 1][base 64 encoded token id …], whereas the id is as long as the entry is smaller than 'b'. So it's ('++', `#m`), ('--', `%am`), ('*@', 'R<^1c'), and so on. '@' is used as a wildcard. As you can see this part parses operators.
- archi42 6y agoFirst thought would be "opcodes", but on a closer look the operators in there seem to be relevant. Maybe this encodes their meaning/relevant opcode and precedence? From the website: ``` binary operators, by decreasing priority order: '*' '/' '%', '+' '-', '>>' '<<', '<' '<=' '>' '>=', '==' '!=', '&', '^', '|', '=', '&&', '||'. ``` The unary operators ++ and -- have a higher precedence, so they come first. Then there are "*@R<^1c", "/@%[_[H3c", "%@%[_[H3c" (same as for '/', though), "+@.B#d" and so. I did not have time to read the source (my compile finished a minute ago), but maybe you can now figure out the rest? :) //edit: ha, edflsafoiewq and xashor we're a bit faster and more thorough. But nice to see we agree on the overall idea.
- caf 6y agoIt's looking for operators. That string encodes the operator to look for, and the values of tokl and tokc that will be used if that operator is found. The first entry looks for "++", and if found sets tokc to 1 ('#' - 'b' + 64) and tokl to 11 ('m' - 'b'). The second entry looks for "--" and if found sets tokc to 255 and tokl to 11. The third entry looks for "*" and if found sets tokc to 12693263 and tokl to 1. (12693263 is 0xc1af0f, which is an x86 IMUL instruction).
- coldtea 6y agoIsn't it obvious? /s