From 2053db2c535ceb5457c30f8ae8832bd37ac3fc2e Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Fri, 3 Dec 2021 21:33:35 -0500 Subject: Clean up lhs grammar spec --- docs/spec/grammar.html | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'docs') diff --git a/docs/spec/grammar.html b/docs/spec/grammar.html index 9f99b430..3b18a102 100644 --- a/docs/spec/grammar.html +++ b/docs/spec/grammar.html @@ -44,12 +44,17 @@ FuncExpr = Train | F ASGN FuncExpr -

Subject expressions are complicated by the possibility of list and namespace assignment, which share the nodes lhsList and lhsStr and cannot be completely distinguished until execution. We also define nothing-statements, which have very similar syntax to subject expressions but do not permit assignment.

+

Subject expressions consist mainly of function application. We also define nothing-statements, which have very similar syntax to subject expressions but do not permit assignment. They can be used as an STMT or in place of a left argument.

arg      = subExpr
          | ( subject | nothing )? Derv arg
 nothing  = "·"
          | ( subject | nothing )? Derv nothing
-NAME     = s | F | _m | _c_
+subExpr  = arg
+         | lhs ASGN subExpr
+         | lhs Derv "↩" subExpr?      # Modified assignment
+
+

The target of subject assignment can be compound to allow for destructuring. List and namespace assignment share the nodes lhsList and lhsStr and cannot be completely distinguished until execution. The term sl in LHS_SUB is used for header inputs below: as an additional rule, it cannot be used in the lhs term of a subExpr node.

+
NAME     = s | F | _m | _c_
 LHS_SUB  = "·" | lhsList | sl
 LHS_ANY  = NAME | LHS_SUB | "(" LHS_ELT ")"
 LHS_ATOM = LHS_ANY | "(" lhsStr ")"
@@ -59,10 +64,7 @@
 lhsList  = "⟨" ? ( ( LHS_ENTRY  )* LHS_ENTRY ? )? "⟩"
 lhsComp  = LHS_SUB | lhsStr | "(" lhs ")"
 lhs      = s | lhsComp
-subExpr  = arg
-         | lhs ASGN subExpr
-         | lhs Derv "↩" subExpr?      # Modified assignment
-
+

A header looks like a name for the thing being headed, or its application to inputs (possibly twice in the case of modifiers). As with assignment, it is restricted to a simple form with no extra parentheses. The full list syntax is allowed for arguments. A plain name is called a label and can be used for a block with or without arguments. First we define headers IMM_HEAD that include no arguments.

headW    = lhs | "𝕨"
 headX    = lhs | "𝕩"
-- 
cgit v1.2.3