Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- source files are always encoded in utf-8
- identifiers for variables not special may include any unicode characters in groups Lu, Ll, Lt, Lm, Lo, Nd, as well as _
- a token comprised only of digits is never treated as an identifier
- eight registers are available as variables
- special variables include >v (VVAR), >x (FTx), >y, >z, >c, <x (FPx), <y, <z, <c, >ma (TMa), >mb, ... >ml, >0 (register 0), ... >7
- operation summary:
- (register manipulation)
- set v x - set v to immediate (floating-point) value x
- copy d s - set d to contents of s
- swap v w - switch contents of v and w (is this actually useful?)
- (binary operators)
- add d v w - set d to v+w
- sub d v w - set d to v-w
- mul d v w - set d to v*w
- div d v w - set d to v/w
- mod d v w - set d to v%w
- polar r t x y - set r to hypot(y, x) and t to atan2(y, x)
- rect x y r t - set x to r*cos(t) and y to r*sin(t)
- pow d v w - set d to pow(v, w)
- atan2 d v w - set d to atan2(w, v)
- hypot d v w - set d to hypot(v, w)
- (ternary)
- spherical r t p x y z - set r to sqrt(x*x+y*y+z*z), t to atan2(y, x), and p to acos(z/sqrt(x*x+y*y+z*z))
- rect3d x y z r t p - set x to r*cos(t)*sin(p), y to r*sin(t)*sin(p), and z to r*cos(p)
- fma d x y z - set d to x*y+z
- (unary)
- neg d v - d = -v
- acos d v - d = acos(v)
- asin d v - arcsine
- atan d v - arctangent
- cos d v - cosine
- cosh d v - hyperbolic cosine
- sin d v - sine
- sinh d v - hyperbolic sine
- tan d v - tangent
- tanh d v - hyperbolic tangent
- exp d v - exponential (e to the power of v)
- ln d v - natural logarithm
- sqrt d v - square root
- ceil d v - ceiling
- abs d v - absolute value
- floor d v - floor
- (shortcuts)
- addtoxy v w - add v to <x and w to <y
- addtoxyz u v w - add u to <x, v to <y, and w to <z
- vaddtoxy v w - fma >v * {v, w} into <x and <y, respectively
- vaddtoxyz u v w - fma >v * {u, v, w} into <x, <y, <z, respectively
- (control flow)
- beq v w n - branch forward n operations if v == w
- bne v w n - branch forward n operations if v != w
- bgt v w n - v > w
- ble v w n - v <= w
- bge v w n - v >= w
- blt v w n - v < w
- end - exit the function
- (randomness)
- randint d - set d to a random integer in [0, RAND_MAX]
- random d - set d to a random real in [0, 1)
- randintr d v w - set d to a random integer in [v, w]
- randomr d v w - set d to a random real in [v, w)
- it is guaranteed that for each operation, the assignment to the destination register(s) is the last thing to occur.
- particular dot directives include:
- .name <variation name> - set the name of the variation; same rules as for identifiers
- .3d - indicate that the variation writes to FPx
- .dc - indicate that the variation writes to TC
- .vars {int | real | range | cyclic} <name> <init> [, ...] - list variables
- .privs {int | real | gauss} <name> [= <init>] [...] - private vars
- .prep - indicate an init() method
- .case <expr> - use the following to the next .case or .calc as the calc() method when expr evaluates to true. a .calc section must exist if any .case sections do.
- .calc - indicate start of calc() method. this is used as the default case; if the interpreter does not understand expressions, it will treat all cases as false and therefore always use .calc.
- private gaussian variables may not be destination variables. new (approximately) gaussian-distributed random values automatically are assigned to them each iteration.
- .name spherivoid // variation name is spherivoid
- .3d // 3d variation
- .vars real spherivoid_radius 0 // like VAR_REAL(spherivoid_radius, 0.0)
- .calc // calculate method
- spherical >0 >1 >2 >x >y >z // set registers 0-2 to spherical coordinates of input
- add >0 >0 spherivoid_radius // add spherivoid_radius to radius in-place
- rect3d >0 >1 >2 >0 >1 >2 // convert spherical coordinates to rectangular in-place
- vaddtoxyz >0 >1 >2 // add coordinates scaled by >v to output
- end
- .name julian
- .vars int julian_power 2, real julian_dist 1
- .privs int absn, real cn
- .prep // init() method
- abs absn julian_power
- div >0 julian_dist julian_power
- set >1 0.5
- mul cn >0 >1
- end
- .calc
- atan2 >0 >x >y
- set >1 0
- randintr >1 >1 absn
- set >2 6.283185308 // 2pi
- fma >0 >1 >2 >0 // 2pi * randint + theta
- div >0 julian_power >0 // (2pi * randint + theta) / power
- mul >1 >x >x // sqr(x)
- fma >1 >y >y >1 // sqr(x) + sqr(y)
- pow >1 >1 cn // pow(sqr(x)+sqr(y), cn)
- mul >1 >1 >v // vvar * pow(sqr(x)+sqr(y), cn)
- rect >0 >1 >0 >1
- addtoxy >0 >1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement