diff options
author | Ben Burwell <ben.burwell@trifecta.com> | 2016-09-14 16:15:20 -0400 |
---|---|---|
committer | Ben Burwell <ben.burwell@trifecta.com> | 2016-09-14 16:15:20 -0400 |
commit | f704918fe2b187d715fe985ebffebdfbdc4b541f (patch) | |
tree | 9fc63b49b81ded84624bc6b1679015baffd7d292 /prog | |
parent | 2c1eee7b2a99985bbe92426368ea32360a4cc0b2 (diff) |
Add repeat and input
Diffstat (limited to 'prog')
-rw-r--r-- | prog/euclideanAlgorithmInput.html | 69 | ||||
-rw-r--r-- | prog/function.doml | 19 | ||||
-rw-r--r-- | prog/function.html | 13 | ||||
-rw-r--r-- | prog/input.html | 28 |
4 files changed, 124 insertions, 5 deletions
diff --git a/prog/euclideanAlgorithmInput.html b/prog/euclideanAlgorithmInput.html new file mode 100644 index 0000000..dfba476 --- /dev/null +++ b/prog/euclideanAlgorithmInput.html @@ -0,0 +1,69 @@ +<!doctype html> +<html> + <head> + <script type="text/javascript" src="../lib/doml.js"></script> + <script> + Doml.runOnLoad(); + </script> + <link rel="stylesheet" href="../lib/style.css"> + </head> + <body> + <span class="statement-sequence"> + <span class="assign" data-name="EuclideanAlgorithm"> + <span class="function" data-args="a,b"> + <span class="statement-sequence"> + <span class="while"> + <span class="compare" data-op="!="> + <span class="variable" data-name="b"></span> + <span class="constant" data-val="0" data-type="number"></span> + </span> + + <span class="branch"> + <span class="compare" data-op=">"> + <span class="variable" data-name="a"></span> + <span class="variable" data-name="b"></span> + </span> + + <span class="assign" data-name="a"> + <span class="bin-op" data-op="-"> + <span class="variable" data-name="a"></span> + <span class="variable" data-name="b"></span> + </span> + </span> + + <span class="assign" data-name="b"> + <span class="bin-op" data-op="-"> + <span class="variable" data-name="b"></span> + <span class="variable" data-name="a"></span> + </span> + </span> + </span> + </span> + + <span class="branch"> + <span class="compare" data-op="=="> + <span class="variable" data-name="a"></span> + <span class="constant" data-val="1" data-type="number"></span> + </span> + <span class="print"> + <span class="constant" data-val="Relatively prime" data-type="string"></span> + </span> + <span class="print"> + <span class="constant" data-val="Found GCD" data-type="string"></span> + <span class="variable" data-name="a"></span> + </span> + </span> + </span> + </span> + </span> + + <span class="input" data-prompt="Enter the first value" data-name="val1" data-type="number"></span> + <span class="input" data-prompt="Enter the second value" data-name="val2" data-type="number"></span> + + <span class="call" data-name="EuclideanAlgorithm"> + <span class="variable" data-name="val1"></span> + <span class="variable" data-name="val2"></span> + </span> + </span> + </body> +</html> diff --git a/prog/function.doml b/prog/function.doml new file mode 100644 index 0000000..841cb0b --- /dev/null +++ b/prog/function.doml @@ -0,0 +1,19 @@ +statement-sequence { + assign(name=myFunc) { + function(args=stringToPrint,val1,val2) { + print { + variable(name=stringToPrint) + bin-op(op=+) { + variable(name=val1) + variable(name=val2) + } + } + } + } + + call(name=myFunc) { + constant(val="hello, world!" type="string") + constant(val="3.5" type="number") + constant(val="7" type="number") + } +} diff --git a/prog/function.html b/prog/function.html index 2fe8d40..f0bf334 100644 --- a/prog/function.html +++ b/prog/function.html @@ -5,7 +5,7 @@ <script> Doml.runOnLoad(); </script> - <link type="stylesheet" href="../lib/style.css"> + <link rel="stylesheet" href="../lib/style.css"> </head> <body> <span class="statement-sequence"> @@ -21,10 +21,13 @@ </span> </span> - <span class="call" data-name="myFunc"> - <span class="constant" data-val="hello, world!" data-type="string"></span> - <span class="constant" data-val="3.5" data-type="number"></span> - <span class="constant" data-val="7" data-type="number"></span> + <span class="repeat" data-iteration="loopTime"> + <span class="constant" data-val="5" data-type="number"></span> + <span class="call" data-name="myFunc"> + <span class="constant" data-val="hello, world!" data-type="string"></span> + <span class="constant" data-val="3.5" data-type="number"></span> + <span class="variable" data-name="loopTime"></span> + </span> </span> </span> </body> diff --git a/prog/input.html b/prog/input.html new file mode 100644 index 0000000..07ca54a --- /dev/null +++ b/prog/input.html @@ -0,0 +1,28 @@ +<!doctype html> +<html> + <head> + <script src="../lib/doml.js"></script> + <script> + Doml.runOnLoad(); + </script> + <link rel="stylesheet" href="../lib/style.css"> + </head> + <body> + <span class="statement-sequence"> + <span class="assign" data-name="greet"> + <span class="function" data-args="name"> + <span class="print"> + <span class="constant" data-val="Hello," data-type="string"></span> + <span class="variable" data-name="name"></span> + </span> + </span> + </span> + + <span class="input" data-prompt="What is your name?" data-name="personToGreet" data-type="string"></span> + + <span class="call" data-name="greet"> + <span class="variable" data-name="personToGreet"></span> + </span> + </span> + </body> +</html> |