一种强大的文本宏命令语言,用于构建二进制文件。
A wicked-powerful text macro language for building binary files. Supports comments, looping, Unicode, variables, conditionals, macros and recursion.
TLDR; Check out example/.
Pre-built binaries are available for Win64 and MacOS64.
$ t2b here
$ t2b # Read directly from stdint2b always writes to stdout. To output to a file, simply use a greater-than sign (>).
Newlines are solely for the sake of readability; all whitespace is the same.
…The need for such a program arose when I was working on writing a simple VM. Manually hex-editing files for an ever changing bytecode spec is tedious, error-prone, and most of all - sucky.
Now there's a lightweight way to do just that.
u8...u64 - Emit unsigned integeri8...i64 - Emit signed integerf - Emit floatd - Emit doublehex - Toggle hex mode on/off (defaults to OFF)str - Write a stringstrl - Write a string AND newlineendl - Write a newlinenot Boolean NOT a charif endif Execute `` if == 1get - Fetch the global variable named exprset - Assign the global variable named expr1 to expr2= - Compare two values, return 0 or 1times endtimes - Execute times. i is always set to the current iteration's index.macro begin endmacro - Declare a custom macro named ``.return - End termination of the current macro. Exits the script if not in a macro.size - Return the size of an itemlen - Equivalent to C strlenIt's now feasible to write a machine code compiler in shell. Hooray. Not sure why you would ever do that to yourself, though.
暂无开放 Issues,或尚未同步最近议题。