aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--language/statements/assignment.rst15
-rw-r--r--language/statements/index.rst1
-rw-r--r--syntax.md13
3 files changed, 16 insertions, 13 deletions
diff --git a/language/statements/assignment.rst b/language/statements/assignment.rst
new file mode 100644
index 0000000..f8c1600
--- /dev/null
+++ b/language/statements/assignment.rst
@@ -0,0 +1,15 @@
+Assignments
+^^^^^^^^^^^
+
+.. crowbar:element:: AssignmentStatement <- AssignmentBody ';'
+ AssignmentBody <- DirectAssignmentBody / UpdateAssignmentBody / CrementAssignmentBody
+
+.. crowbar:element:: DirectAssignmentBody <- AssignmentTarget '=' Expression
+
+ .. todo:: define direct assignment
+
+.. crowbar:element:: UpdateAssignmentBody <- AssignmentTarget ('+=' / '-=' / '*=' / '/=' / '%=' / '&=' / '^=' / '|=') Expression
+
+.. crowbar:element:: CrementAssignmentBody <- AssignmentTarget ('++' / '--')
+
+.. todo:: define other assignments relative to direct
diff --git a/language/statements/index.rst b/language/statements/index.rst
index ac76f3b..623eb23 100644
--- a/language/statements/index.rst
+++ b/language/statements/index.rst
@@ -32,3 +32,4 @@ Statements
variables
structure
flow-control
+ assignment
diff --git a/syntax.md b/syntax.md
index 9d11600..083103c 100644
--- a/syntax.md
+++ b/syntax.md
@@ -3,19 +3,6 @@
### Statements
```PEG
-AssignmentStatement ← AssignmentStatementBody ';'
-AssignmentStatementBody ← AssignmentTargetExpression '=' Expression /
- AssignmentTargetExpression '+=' Expression /
- AssignmentTargetExpression '-=' Expression /
- AssignmentTargetExpression '*=' Expression /
- AssignmentTargetExpression '/=' Expression /
- AssignmentTargetExpression '%=' Expression /
- AssignmentTargetExpression '&=' Expression /
- AssignmentTargetExpression '^=' Expression /
- AssignmentTargetExpression '|=' Expression /
- AssignmentTargetExpression '++' /
- AssignmentTargetExpression '--'
-
ExpressionStatement ← Expression ';'
```