Gash Abstract Syntax Tree Specification *************************************** Gash parses the shell language into an abstract syntax tree (AST) that has the following form. sync ::= exp | (' exp) exp ::= pipe | (' exp1 exp2) | (' exp1 exp2) | (' pipe) pipe ::= cmd* | (' cmd* ...) cmd* ::= cmd | (' name sync ...) cmd ::= (' word ...) | (' ((var var-word) ...) word ...) | (' (redir ...) [cmd]) | (' (var word) ...) | (' sync ...) | (' (name (word ...)) sync ...) | (' word ((pattern-word ...) sync ...) ...) | (' (list sync ...) ... [(' sync ...)]) | (' list sync ...) | (' list sync ...) | (' sync ...) redir ::= ('> fdes word) | ('< fdes word) | ('>& fdes word) | ('<& fdes word) | ('>> fdes word) | ('<> fdes word) | ('>! fdes word) | ('<< fdes word) Internally, the parser also uses these two forms: | ('<< fdes (' qword)) | ('<<- fdes (' qword)) word ::= string | (word ...) | (' word) | (' sync ...) | (' word) | (' var) | (' var [word]) | (' var [word]) | (' var [word]) | (' var [word]) | (' var [word]) | (' var [word]) | (' var [word]) | (' var [word]) | (' var [word]) | (' var [word]) | (' var [word]) | (' var [word]) | (' var) var ::= string | ("LINENO" integer) The parser never returns a qword, but it is a useful notion. It gets used internally by the parser and by the `word' module. qword ::= string | (qword ...) | (' qword) Copying this file ================= Copyright © 2018, 2019 Timothy Sample Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.