1Imager::Expr::Assem(3)User Contributed Perl DocumentationImager::Expr::Assem(3)
2
3
4
6 Imager::Expr::Assem - an assembler for producing code for the Imager
7 register machine
8
10 use Imager::Expr::Assem;
11 my $expr = Imager::Expr->new(assem=>'...', ...)
12
14 This module is a simple Imager::Expr compiler that compiles a low-level
15 language that has a nearly 1-to-1 relationship to the internal
16 representation used for compiled register machine code.
17
18 Syntax
19 Each line can contain multiple statements separated by semi-colons.
20
21 Anything after '#' in a line is ignored.
22
23 Types of statements:
24
25 variable definition
26 "var" name:type
27
28 defines variable name to have type, which can be any of "n" or
29 "num" for a numeric type or "pixel", "p" or "c" for a pixel or
30 color type.
31
32 Variable names cannot include white-space.
33
34 operators
35 Operators can be split into 3 basic types, those that have a result
36 value, those that don't and the null operator, eg. jump has no
37 value.
38
39 The format for operators that return a value is typically:
40
41 result = operator operand ...
42
43 and for those that don't return a value:
44
45 operator operand
46
47 where operator is any valid register machine operator, result is
48 any variable defined with "var", and operands are variables,
49 constants or literals, or for jump operators, labels.
50
51 The set operator can be simplified to:
52
53 result = operator
54
55 All operators maybe preceded by a label, which is any non-white-
56 space text immediately followed by a colon (':').
57
59 Note that the current optimizer may produce incorrect optimization for
60 your code, fortunately the optimizer will disable itself if you include
61 any jump operator in your code. A single jump to anywhere after your
62 final "ret" operator can be used to disable the optimizer without
63 slowing down your code.
64
65 There's currently no high-level code generation that can generate code
66 with loops or real conditions.
67
69 Imager(3), transform.perl, regmach.c
70
72 Tony Cook <tony@develop-help.com>
73
74
75
76perl v5.36.0 2023-01-20 Imager::Expr::Assem(3)