Add remaining arithmetic comparisons (and test program) to USC
This commit is contained in:
parent
4a52ff534f
commit
615c66f304
5 changed files with 43 additions and 6 deletions
25
wip-duuqnd/user-side-compiler/example-5.c6l
Normal file
25
wip-duuqnd/user-side-compiler/example-5.c6l
Normal file
|
@ -0,0 +1,25 @@
|
|||
x = random()
|
||||
|
||||
if x == 1 then
|
||||
placeholder()
|
||||
end
|
||||
|
||||
if x != 1 then
|
||||
placeholder()
|
||||
end
|
||||
|
||||
if x > 1 then
|
||||
placeholder()
|
||||
end
|
||||
|
||||
if x >= 1 then
|
||||
placeholder()
|
||||
end
|
||||
|
||||
if x < 1 then
|
||||
placeholder()
|
||||
end
|
||||
|
||||
if x <= 1 then
|
||||
placeholder()
|
||||
end
|
|
@ -66,10 +66,14 @@
|
|||
|
||||
(define-standard-expr-node node-expr-plus)
|
||||
(define-standard-expr-node node-expr-minus)
|
||||
(define-standard-expr-node node-expr-test-equal)
|
||||
(define-standard-expr-node node-expr-test-not-equal)
|
||||
(define-standard-expr-node node-expr-multiply)
|
||||
(define-standard-expr-node node-expr-divide)
|
||||
(define-standard-expr-node node-expr-test-equal)
|
||||
(define-standard-expr-node node-expr-test-not-equal)
|
||||
(define-standard-expr-node node-expr-test-less)
|
||||
(define-standard-expr-node node-expr-test-less-or-equal)
|
||||
(define-standard-expr-node node-expr-test-greater)
|
||||
(define-standard-expr-node node-expr-test-greater-or-equal)
|
||||
|
||||
;;;
|
||||
|
||||
|
|
|
@ -117,5 +117,7 @@ solely due to its output being unused."))
|
|||
(ops (ir-comparison)
|
||||
(ir-test-equal node-expr-test-equal "==")
|
||||
(ir-test-not-equal node-expr-test-not-equal "!=")
|
||||
(ir-test-less nil "<") (ir-test-greater nil ">")
|
||||
(ir-test-less-or-equal nil "<=") (ir-test-greater-or-equal nil ">=")))
|
||||
(ir-test-less node-expr-test-less "<")
|
||||
(ir-test-greater node-expr-test-greater ">")
|
||||
(ir-test-less-or-equal node-expr-test-less-or-equal "<=")
|
||||
(ir-test-greater-or-equal node-expr-test-greater-or-equal ">=")))
|
||||
|
|
|
@ -112,8 +112,10 @@ parser's debug output.")
|
|||
(token-not-equal node-expr-test-not-equal))
|
||||
|
||||
(define-binary-expr-matcher comparison term
|
||||
(token-less-than node-expr-test-equal)
|
||||
(token-greater-than node-expr-test-not-equal))
|
||||
(token-less-than node-expr-test-less)
|
||||
(token-less-or-equal node-expr-test-less-or-equal)
|
||||
(token-greater-than node-expr-test-greater)
|
||||
(token-greater-or-equal node-expr-test-greater-or-equal))
|
||||
|
||||
(define-binary-expr-matcher term factor
|
||||
(token-plus node-expr-plus)
|
||||
|
|
|
@ -80,7 +80,9 @@ reading immediately. Should be a subset of *SPECIAL-TOKEN-CHARS*.")
|
|||
(define-atomic-token token-slash)
|
||||
|
||||
(define-atomic-token token-less-than)
|
||||
(define-atomic-token token-less-or-equal)
|
||||
(define-atomic-token token-greater-than)
|
||||
(define-atomic-token token-greater-or-equal)
|
||||
(define-atomic-token token-equal-equal)
|
||||
(define-atomic-token token-not-equal)
|
||||
|
||||
|
@ -102,7 +104,9 @@ reading immediately. Should be a subset of *SPECIAL-TOKEN-CHARS*.")
|
|||
("(" token-open-paren)
|
||||
(")" token-close-paren)
|
||||
("<" token-less-than)
|
||||
("<=" token-less-or-equal)
|
||||
(">" token-greater-than)
|
||||
(">=" token-greater-or-equal)
|
||||
("=" token-equal)
|
||||
("==" token-equal-equal)
|
||||
("!=" token-not-equal)))
|
||||
|
|
Loading…
Add table
Reference in a new issue