Compiling and Decompiling
Before an AppleScript program can be run, it must be compiled. To compile something means to transform it, behind the scenes, from text—the form in which a human user is able to read and edit the code—to a form consisting of actual executable instructions intended for a machine.
Compiling
The nature of compiled code depends upon the nature of the engine that runs it. In the case of a C program written for a Macintosh, the engine is the Macintosh’s central processing unit (CPU); so the compiled code must consist of machine-language instructions in accordance with the CPU chip’s specifications. Such machine-language instructions, indeed, are the only instructions your computer can really execute, because the computer’s ultimate “brain” is the CPU.
In the case of AppleScript, the engine is the AppleScript scripting component, and compiled code does not consist of anything so low-level. AppleScript compiled code is bytecode : roughly, the nouns and verbs of the original text are translated into some sort of compressed, coded equivalent (called tokens ). These tokens are meaningful only to the AppleScript scripting component’s run-engine. When it runs the code, the engine still has to parse whatever tokens it meets along its path of execution, accumulating them into chunks and translating these chunks further in order to execute them. It is usual to describe a language that is compiled and executed in this way as being interpreted .
There isn’t necessarily anything ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access