A small document on ALS syntax.
- A rule is a single statement in ALS.
- A rule is defined by the following pattern:
short -> long
- The rule above means: expandshort
intolong
. - It's equivalent toalias "short=long"
- A transformation is an action performed on an ALS file.
- It's defined by the following pattern:
filename --> pattern
- For each line offilename
, transform it according to the pattern. - Every occurrence of$$
in the pattern is replaced with thelong
part of the rule - Example:./dir.als --> cd $$
- Transformsfoo -> bar
intofoo -> cd bar
- All transformations are recursive. The output of one transformation becomes the
$$
of the ones above it on the recursion stack.
- The global pattern is the output format specified when invoking
genalias2
- The default pattern is
alias "$<=$$"
, which generates standard shell aliases. - Any occurrence of
$<
in the pattern is replaced with theshort
part of the rule - Any occurrence of
$$
in the pattern is replaced with thelong
part of the rule
- Comments in ALS begin with
#
- Comments can be placed anywhere in the file, including after statements
- An ALS statement must be contained in a single line
- Empty lines and lines containing only whitespace are ignored.
- IMPORTANT: Whitespace is required around the arrows (
->
and-->
) -foo -> bar
is fine, same asfoo -> bar
, butfoo-> bar
is not, same withfoo ->bar
andfoo-->bar
- Both spaces and tabs can be used here - Additional whitespace (like alignment) is ignored