Syntax guide for Zoidberg

Since the syntax of the Zoidberg shell is completely configable we can only comment on the syntax as defined by the default config files.

The general structure will be mostly the same for any configuration but any markup or sign can be changed till the syntax is completely un recognizable.

All this config can be found in the {grammar} hash, which is by default stored in the grammar.pd file.

Default syntax parsing

The zoidberg syntax consists of three levels of grouping:

Logical grouping

First the syntax is split into blocks with logical/script delimitters

This can be signs:

[block] && [block] || [block] ; [block]

Or words:

[block] AND [block] OR [block] EOS [block]

These are exactly the same

Pipes and redirections

Once the string is cut into logical blocks each of these blocks is split in sub_blocks by pipes and redirections

For now one can only use _copies_ of the zoidberg object tree in pipelines -- we hope to use threads for this in the future.

[sub_block] | [sub_block] > [sub_block]

context blocks

At last for each sub_block the parsing rules in the grammar decide a context like 'ZOID', 'PERL', 'SYSTEM' or 'SQL'

Now the parsing of each sub_block is handed to a suitable subroutine.

Aliases are handled on this level but before deciding the context - so it is possible to alias to context mark_up.

examples

Some system binary -- context SYSTEM

zoid> mplayer -vo sdl -ao sdl my_favorite_movie.avi

Perl code between brackets -- context PERL

zoid> { print "This is perl code."; }

A subroutine call to a object loaded in zoidberg

zoid> ->Help->help -or- zoid> ->Help->help('objects')

A zoidberg command preceded by an underscore

zoid> _cd /usr/local zoid> _back

And as described above all of these can be combined:

zoid> _cd /usr/local AND { print "This is perl code."; } | less || sql{SELECT * FROM users WHERE clue > 0}

This will first execute _cd /usr/local on sucess followed by { print "This is perl code."; } | less If one of these failes we got to see the result of sql{SELECT * FROM users WHERE clue > 0}

The hierarchy is thus: ( ( 1 && ( 2 | 3 ) ) || 4 ) Where 1 = _cd /usr/local, 2 = { print "This is perl code."; }, 3 = less and 4 = sql{SELECT * FROM users WHERE clue > 0}