aboutsummaryrefslogtreecommitdiff
path: root/examples/comparisons.cup
diff options
context:
space:
mode:
authorMustafa Quraish <[email protected]>2022-01-29 00:20:09 -0500
committerMustafa Quraish <[email protected]>2022-01-29 00:42:58 -0500
commit08056428cec5d1e63e471590ac09d82dcbfcab93 (patch)
treee71c34fb2a47780a6e01d8fa0a2af4b3bd3e7130 /examples/comparisons.cup
parentAdd some arithmetic binary operations into lex+parse+generation (diff)
downloadcup-08056428cec5d1e63e471590ac09d82dcbfcab93.tar.xz
cup-08056428cec5d1e63e471590ac09d82dcbfcab93.zip
Add relational and logical operators + refactor binop parser
We now support OR and AND with short circuiting! (Yet to be tested since we don't yet have local variables to play with). The binop parser took a bit of an overhaul factoring out the common code so that it's easier to describe the operator precendence relationships without being overly repetitive.
Diffstat (limited to 'examples/comparisons.cup')
-rw-r--r--examples/comparisons.cup3
1 files changed, 3 insertions, 0 deletions
diff --git a/examples/comparisons.cup b/examples/comparisons.cup
new file mode 100644
index 0000000..d2bd41f
--- /dev/null
+++ b/examples/comparisons.cup
@@ -0,0 +1,3 @@
+fn main() {
+ return (5 == 3) + (5 > 4) + (1 != 2);
+} \ No newline at end of file