Polymorph Assembly Introduction
Jakob Jenkov |
Polymorph Assembly is a textual language that can be translated into either raw binary data, Polymorph Data binary data (Pinary) or Polymorph VM bincode. Polymorph assembly is intended to give you maximal control over the binary data or instructions you generate, so it is a bit more verbose than other language syntaxes. This is similar to how other assembly languages are designed.
The main purpose of Polymorph Assembly is to make it easy to author data, configuration and code files in a standard text editor, as well as convert binary Polymorph Data or Polymorph VM bincode to text, for easier debugging.
It is not intended that systems exporting data to binary Polymorph Data will do so by exporting to Polymorph Assembly. While this is theoretically possible, it is expected that such exports will be generating binary Polymorph Data directly. The same is probably true of Polymorph VM bincode generation. You might as well generate the finished bincode directly.
The Polymorph Assembler
Polymorph Assembly is interpreted and translated by the Polymorph Assembler. The Polymorph Assembler is included in the Polymorph Fabric project.
Syntaxes
As mentioned in the introduction, Polymorph Assembly supports multiple syntaxes. These syntaxes are:
- Raw binary data
- Polymorph Data
- Polymorph VM Bincode
Each of these syntaxes will be described later in this text.
Syntax Switches
The Polymorph Assembler needs to know what syntax it is currently looking at. You tell that to the Polymorph Assembler via a set of syntax switches. There is one syntax switch for each supported syntax.
The syntax switches start with the character @ followed by a set of brackets enclosing the assembly code using that syntax. Here is what the syntax switches look like:
@[ ] @< > @{ }
The @[ ]
syntax switch demarcates raw binary data assembly code.
The @< >
syntax switch demarcates Polymorph Data assembly code.
The @{ }
syntax switch demarcates Polymorph VM bincode assembly code.
It is possible that in the future Polymorph Assembly may arrive at a single unified syntax, but for now the syntax switches are necessary.
Tweet | |
Jakob Jenkov |