APL is like a diamond. It has a beautiful crystal structure; all of its parts are related in a uniform and elegant way. But if you try to extend this structure in any way—even by adding another diamond—you get an ugly kludge. LISP, on the other hand, is like a ball of mud. You can add any amount of mud to it and it still looks like a ball of mud.
— (attributed to) Joel Moses
SX-ALGOL is used as an intermediate representation in the Naur compiler, but can also be used to write programs directly. It is designed to look like procedure applications that build up the SX-ALGOL AST.
This document describes the BNF grammar of SX-ALGOL in the same terms as the Report. It is based off of an LL(1) grammar of ALGOL 60.
Some differences:
(begin(⟨declaration list⟩)⟨statement list⟩)(⟨declaration⟩)⟨declaration list⟩(⟨argument specification list⟩)⟨statement list⟩(⟨identifier⟩⟨identifier list⟩)⟨expression pair list⟩(⟨expression⟩⟨expression⟩)⟨expression pair list continue⟩(⟨specifier⟩⟨identifier⟩⟨identifier list⟩)⟨argument specification list⟩(for⟨for statement next⟩)(if⟨expression⟩⟨statement⟩⟨statement⟩)(label⟨statement list⟩)(go to⟨expression⟩)(set!(⟨identifier⟩⟨identifier list⟩)⟨expression⟩)(⟨procedure statement⟩)()(⟨for element⟩⟨for element list⟩)⟨statement list⟩(step⟨expression⟩⟨expression⟩⟨expression⟩)(while⟨expression⟩⟨expression⟩)Boolean, arithmetic, and relational expressions are expressed in procedure form and hence omitted from the grammar.
(if⟨expression⟩⟨expression⟩⟨expression⟩)(subscript⟨identifier⟩⟨expression⟩⟨expression list⟩)(⟨identifier⟩⟨expression list⟩)