aboutsummaryrefslogtreecommitdiff
path: root/syntax/List.py
diff options
context:
space:
mode:
Diffstat (limited to 'syntax/List.py')
-rwxr-xr-xsyntax/List.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/syntax/List.py b/syntax/List.py
new file mode 100755
index 0000000..a6d8afc
--- /dev/null
+++ b/syntax/List.py
@@ -0,0 +1,28 @@
+#!/usr/bin/python3
+
+# Copyright 2025, Jonas Smedegaard <dr@jones.dk>
+# SPDX-License-Identifier: GPL-3+
+
+from railroad import *
+
+Diagram(
+ Choice(0,
+ "[-*]",
+ Sequence(
+ "[[:digit:]]+",
+ "[).]",
+ )
+ ),
+ Choice(0,
+ Sequence(
+ NonTerminal("_"),
+ Choice(0,
+ NonTerminal("List"),
+ NonTerminal("Words")
+ )
+ ),
+ Skip()
+ ),
+ NonTerminal("NEWLINE"),
+ type="complex"
+).writeStandalone(sys.stdout.write)