aboutsummaryrefslogtreecommitdiffstats
execline: language design and grammar

execline
Software
skarnet.org

The execline language design and grammar

execline principles

Here are some basic Unix facts:

Knowing that, and wanting lightweight and efficient scripts, I wondered: "Why should the interpreter stay in memory while the script is executing? Why not parse the script once and for all, put it all into one argv, and just execute into that argv, relying on external commands (which will be called from within the script) to control the execution flow?"

execline was born.

  • execline is the first script language to rely entirely on chain loading. An execline script is a single argv, made of a chain of programs designed to perform their action then exec() into the next one.
  • The execlineb command is a launcher: it reads and parses a text file, converting it to an argv, then executes into that argv. It does nothing more.
  • Straightforward scripts like nice -10 echo blah will be run just as they are, without the shell overhead. Here is what the script could look like:
    #!/command/execlineb -P
    nice -10
    echo blah
    
  • More complex scripts will include calls to other execline commands, which are meant to provide some control over the process state and execution flow from inside an argv.

Grammar of an execline script

An execline script can be parsed as follows:

 <instruction> = <> | external options <arglist> <instruction> | builtin options <arglist> <blocklist> <instruction>
 <arglist> = <> | arg <arglist>
 <blocklist> = <> | <block> <blocklist>
 <block> = { <arglist> } | { <instrlist> }
 <instrlist> = <> | <instruction> <instrlist>

(This grammar is ambivalent, but much simpler to understand than the non-ambivalent ones.)

execline features

execline commands can perform some transformations on their argv, to emulate some aspects of a shell. Here are descriptions of these features: