Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] BNF grammar of REBOL for code "obfuscator"

From: geza67::freestart::hu at: 17-Dec-2001 16:30

Hello REBOLers, I would like to write a code "obfuscator" (C-ish intention, isn't it ;-)) ) for REBOL. Tha main idea behind is to have a custom loader by 'COMPRESSing the program code and 'DECOMPRESS it on load, like this: - the "packager" REBOL line: write/binary %someprog.bin compress read %someprog.r - the shell loader (WinDOS .BAT file): rebol.exe -s --noinstall --do "do decompress read/binary %%someprog.bin quit" To get the unnecessary overhead data out of the script I would like to - strip the header to the simplest "REBOL []" form - extinct one-line and block comments - reduce tabulation and blank lines to single whitespace My first approach to detect the end of the REBOL header did not work: I just cannot keep track of the nested block levels in parse rules :-( I also stucked at detecting comment boundaries - to detect one-line comments whether they are _real_ comments or just ";" characters buried within a string (both "" and {} delimited) - detect 'COMMENT blocks (reprise of the previously mentioned detection problem for nested blocks) Do you have an exact BNF notation (or directly 'PARSE rules) of the REBOL language ? I searched the library but even %color-code.r is very spartanian and does not destructure a REBOL script this way (although its syntax coloring purpose might have suggested so). Thanx for your commitment of ideas! -- Best regards, Geza Lakner MD mailto:[geza67--freestart--hu]