Apex Scripting
Ascript is an easy, extensible, fast, free script interpreter.
Where
https://cordialmind.blogspot.com/2021/04/book-and-software-urls.htmlSpeed
BASH, busybox, C, C++, coreutils, cpio, findutils, kmod, PERL, Python, SED, systemd, util-linux are slower.
Tasks
Boot, shutdown, software logistics are possible.
Stripped Size
ELF ascript 30K! ELFSO 2M! PIC yes! PIE no!.
Compile Duration
10 seconds or less is typical.
Required
cp, gcc, install, ld, Linux, ln, make, mkdir, nm, sed, rm
Debugging
Segfault locations can be reported. Script can be traced.
Optional
Linux-PAM; file; pcre2 if installed optional argot are compiled.
Why
The ascript.5 manual page when read why becomes apparent.
Quality
4th generation revision quality was exceeded.
Fun
For the IT elite the fun noob feeling resumes. FORTRAN and CP/M are not emulated. A simple two register asm language since emulated an asm hacker similar power rush is attained.
Samples
siptest
io out now `Which color is pretty? ` out now `I also like ` sip
meow-world
#!ascript/ascript io, out now `Meow World.\n`
hello
#!ascript/ascript a, io LC `` target origin LC_DOMAIN_DIR `./locale-test\0`,= #target origin LC_ALL `de_DE.utf8\0`,= target origin LC_ALL `es_ES.utf8\0`,= LC `Hello world\0` out LC # The following two files are required. # locale-test/de/LC_MESSAGES/hello.mo # locale-test/es/LC_MESSAGES/hello.mo # i18n translation if done # similar file generation was done.
timertest
#!ascript/ascript a, io, self name t, timer, scope target t.sig, sig restart sig sum origin "action", sig pin origin t.sig.sum, sig target origin 1 x, sig init target origin t.lull.sec 1 x, = target host, timer init 'again', self pause go 'again' "action", test, go 'tock' err now t.sig.sum ` tick\n`, ret 'tock' err now t.sig.sum ` tock\n`, ret
nodelisttest
a, io, stat name A node list node list with node list deep node list full node list lean node list less node list link node list most node list name node list path node list type scope stat sym target A.statsym stat size node list stat target `/usr/share/man` node list path name 'again' node list next go 'done' out `deep ` A.deep `\n` \ `full ` A.full `\n` \ `lean ` A.lean `\n` \ `less ` A.less `\n` \ `link ` A.link `\n` \ `most ` A.most `\n` \ `name ` A.name `\n` \ `path ` A.path `\n` \ `type ` A.type `\n` \ `size ` A.statsym.size `\n` go 'again' 'done' out now `All done\n`
cpio_make
a, err, io chdir `/` name B, cpio newc, scope name A, node list, scope node list with node list most target `usr/share/man` node list path name target origin B A.most cpio newc push cpio newc with 'again' node list next, go 'done' out A.most `\n` cpio newc add, go 'fail' go 'again' 'done' #target origin `/tmp/man.cpio` B, io save, go 'fail' target `/man.cpio`, cpio newc save, go 'fail' ret 'fail' err not errtext ret
envwalk
a, env, io, link target origin env out 'again' link next, ret target origin swap, byte line target origin swap go 'again'
selfargvtest
a, io, ray self, self argv target self.argv ray with ray max out now `self.argv.max=` self.argv.max `\n` target out 'again' ray origin byte line ray next ret go 'again'
inttest
a, int, io name A, int 8, scope, set 5 x name B, int 8, scope, set 6 x name C, int 8, scope, #dex target origin C A,= origin B,+ out now `C=` C `\n`
Style
An argot: when reached the code is executed; at line start or aft comma exist; by tab parameters are separated; by comma or line feed are ended. UTF-8 is supported. By `` text bytes are enclosed. By '' near lables are enclosed. By "" far labels are enclosed. Var names are not enclosed. By space and single byte suffix such as: b; o; d; f; x a numeric constant is indicated. For argot name 1 to 16 bytes exist. For near label 1 to 16 bytes exist. For far label 1 to 16 bytes exist. For var name 1 to 32 bytes can exist.
Operators
Asm, C, and ascript operators exist. For target data type the operators tacitly overload.
Arithmetic
8 byte and 4 byte integer and 8 byte fixed point are possible. Input output supported formats follow: ASCII binary; ASCII octal; ASCII decimal; ASCII hexadecimal; big endian; little endian.
Flow Control
For some argot with success the next argot is skipped with failure the next argot is invoked.
Errno Parsing
'EINVAL' 'E2BIG' 'EACCESS' 'ENOENT' ... near labels can be reached or visited.
Cosmetic Boons
do if then else until while [] {} () <> are abstained. In columns names when typed errors seem apparent.