mes/module/nyacc/lang/c99/mach.d/cppact.scm

111 lines
4.9 KiB
Scheme
Raw Normal View History

;; ./mach.d/cppact.scm
2017-01-01 15:54:21 +00:00
;;
;;
;; This software is covered by the GNU GENERAL PUBLIC LICENCE, Version 3,
2017-01-01 15:54:21 +00:00
;; or any later version published by the Free Software Foundation. See
;; the file COPYING included with the this distribution.
(define act-v
(vector
;; $start => conditional-expression
(lambda ($1 . $rest) $1)
;; conditional-expression => logical-or-expression
(lambda ($1 . $rest) $1)
;; conditional-expression => logical-or-expression "?" logical-or-expres...
(lambda ($5 $4 $3 $2 $1 . $rest)
`(cond-expr ,$1 ,$3 ,$5))
;; logical-or-expression => logical-and-expression
(lambda ($1 . $rest) $1)
;; logical-or-expression => logical-or-expression "||" logical-and-expre...
(lambda ($3 $2 $1 . $rest) `(or ,$1 ,$3))
;; logical-and-expression => bitwise-or-expression
(lambda ($1 . $rest) $1)
;; logical-and-expression => logical-and-expression "&&" bitwise-or-expr...
(lambda ($3 $2 $1 . $rest) `(and ,$1 ,$3))
;; bitwise-or-expression => bitwise-xor-expression
(lambda ($1 . $rest) $1)
;; bitwise-or-expression => bitwise-or-expression "|" bitwise-xor-expres...
(lambda ($3 $2 $1 . $rest) `(bitwise-or ,$1 ,$3))
;; bitwise-xor-expression => bitwise-and-expression
(lambda ($1 . $rest) $1)
;; bitwise-xor-expression => bitwise-xor-expression "^" bitwise-and-expr...
(lambda ($3 $2 $1 . $rest)
`(bitwise-xor ,$1 ,$3))
;; bitwise-and-expression => equality-expression
(lambda ($1 . $rest) $1)
;; bitwise-and-expression => bitwise-and-expression "&" equality-expression
(lambda ($3 $2 $1 . $rest)
`(bitwise-and ,$1 ,$3))
;; equality-expression => relational-expression
(lambda ($1 . $rest) $1)
;; equality-expression => equality-expression "==" relational-expression
(lambda ($3 $2 $1 . $rest) `(equal ,$1 ,$3))
;; equality-expression => equality-expression "!=" relational-expression
(lambda ($3 $2 $1 . $rest) `(noteq ,$1 ,$3))
;; relational-expression => shift-expression
(lambda ($1 . $rest) $1)
;; relational-expression => relational-expression "<" shift-expression
(lambda ($3 $2 $1 . $rest) `(lt ,$1 ,$3))
;; relational-expression => relational-expression "<=" shift-expression
(lambda ($3 $2 $1 . $rest) `(le ,$1 ,$3))
;; relational-expression => relational-expression ">" shift-expression
(lambda ($3 $2 $1 . $rest) `(gt ,$1 ,$3))
;; relational-expression => relational-expression ">=" shift-expression
(lambda ($3 $2 $1 . $rest) `(ge ,$1 ,$3))
;; shift-expression => additive-expression
(lambda ($1 . $rest) $1)
;; shift-expression => shift-expression "<<" additive-expression
(lambda ($3 $2 $1 . $rest) `(lshift ,$1 ,$3))
;; shift-expression => shift-expression ">>" additive-expression
(lambda ($3 $2 $1 . $rest) `(rshift ,$1 ,$3))
;; additive-expression => multiplicative-expression
(lambda ($1 . $rest) $1)
;; additive-expression => additive-expression "+" multiplicative-expression
(lambda ($3 $2 $1 . $rest) `(add ,$1 ,$3))
;; additive-expression => additive-expression "-" multiplicative-expression
(lambda ($3 $2 $1 . $rest) `(sub ,$1 ,$3))
;; multiplicative-expression => unary-expression
(lambda ($1 . $rest) $1)
;; multiplicative-expression => multiplicative-expression "*" unary-expr...
(lambda ($3 $2 $1 . $rest) `(mul ,$1 ,$3))
;; multiplicative-expression => multiplicative-expression "/" unary-expr...
(lambda ($3 $2 $1 . $rest) `(div ,$1 ,$3))
;; multiplicative-expression => multiplicative-expression "%" unary-expr...
(lambda ($3 $2 $1 . $rest) `(mod ,$1 ,$3))
;; unary-expression => postfix-expression
(lambda ($1 . $rest) $1)
;; unary-expression => "-" unary-expression
(lambda ($2 $1 . $rest) `(neg ,$2))
;; unary-expression => "+" unary-expression
(lambda ($2 $1 . $rest) `(pos ,$2))
;; unary-expression => "!" unary-expression
(lambda ($2 $1 . $rest) `(not ,$2))
;; unary-expression => "~" unary-expression
(lambda ($2 $1 . $rest) `(bitwise-not ,$2))
;; unary-expression => "++" unary-expression
(lambda ($2 $1 . $rest) `(pre-inc ,$2))
;; unary-expression => "--" unary-expression
(lambda ($2 $1 . $rest) `(pre-dec ,$2))
;; postfix-expression => primary-expression
(lambda ($1 . $rest) $1)
;; postfix-expression => postfix-expression "++"
(lambda ($2 $1 . $rest) `(post-inc ,$1))
;; postfix-expression => postfix-expression "--"
(lambda ($2 $1 . $rest) `(post-dec ,$1))
;; primary-expression => '$fixed
(lambda ($1 . $rest) `(fixed ,$1))
;; primary-expression => '$chlit
(lambda ($1 . $rest) `(char ,$1))
;; primary-expression => "defined" "(" '$ident ")"
(lambda ($4 $3 $2 $1 . $rest) `(defined ,$3))
;; primary-expression => "(" expression-list ")"
(lambda ($3 $2 $1 . $rest) $2)
;; expression-list => conditional-expression
(lambda ($1 . $rest) $1)
;; expression-list => expression-list "," conditional-expression
(lambda ($3 $2 $1 . $rest) $3)
))
;;; end tables