aboutsummaryrefslogtreecommitdiff
path: root/Auxiliary/Grammars/kranc2.peg
diff options
context:
space:
mode:
Diffstat (limited to 'Auxiliary/Grammars/kranc2.peg')
-rw-r--r--Auxiliary/Grammars/kranc2.peg19
1 files changed, 19 insertions, 0 deletions
diff --git a/Auxiliary/Grammars/kranc2.peg b/Auxiliary/Grammars/kranc2.peg
new file mode 100644
index 0000000..7017b42
--- /dev/null
+++ b/Auxiliary/Grammars/kranc2.peg
@@ -0,0 +1,19 @@
+skipper = ([ \t\n\r]+|#.*)*
+end = ([ \t]+|#.*)*\r*\n
+name = [A-Za-z][A-Za-z0-9]*
+uname = [A-Za-z][A-Za-z0-9_]*
+indices = ([_^]([a-zA-Z]'*)+)*
+tensor = {name}{indices}
+dtensor = D{indices} {tensor}
+number = -?[0-9]+(\.[0-9]*|)([eEdD][+-]?[0-9]+|)
+func = {name} \( {expr} \)
+value = {func}|{dtensor}|{tensor}|{number}|\( {expr} \)
+pow = {value}( \*\* {value}|)
+mulop = [*/%]
+mul = {pow}( {mulop} {pow})*
+addop = [+-]
+expr = {mul}( {addop} {mul})*
+eqn = ({dtensor}|{tensor}) \= {expr}{-end}
+eqns = {eqn}( {eqn})*
+thorn = begin[ ]+thorn {name}{-end}( {calculation})* end[ ]+thorn
+calculation = begin[ ]+calculation {uname}{-end} {eqns} end[ ]+calculation