This is the mail archive of the cgen@sourceware.org mailing list for the CGEN project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

extending pmacro facility


Hi.

I'd like to extend the pmacro facility to make it easier for .cpu file writers to decide how they want to write their .cpu files.

To that end I plan to add several new builtin pmacros.
For reference sake, here's the complete list.
[I'm a bit ambivalent on cadr, etc.]

; (.sym symbol1 symbol2 ...) - symbolstr-append
; (.str string1 string2 ...) - stringsym-append
; (.hex number [width]) - convert to hex string
; (.upcase string)
; (.downcase string)
; (.substring string start end) - get part of a string
; (.splice a b (.unsplice c) d e ...) - quasi-quote/unquote-splicing
; (.iota count [start [increment]]) - number generator
; (.map macro-name arg1 ...)
; (.for-each pmacro arg1 ...)
; (.apply macro-name arg)
; (.pmacro (arg-list) expansion) - lambda
; (.if expr then [else])
; (.case expr ((case-list1) stmt) [case-expr-stmt-list] [(else stmt)])
; (.cond (expr stmt) [(cond-expr-stmt-list)] [(else stmt)])
; (.begin [stmt-list])
; (.print . exprs) - for debugging messages
; (.dump expr) - dump expr in readable format
; (.error . message) - print error message and exit
; (.list . exprs)
; (.ref l n) - extract the n'th element of list l
; (.length l) - length of list l
; (.replicate n expr) - return list of expr replicated n times
; (.equals x y) - deep comparison
; (.and expr . rest) - && in C
; (.or expr . rest) - || in C
; (.not expr) - ! in C
; (.eq x y)
; (.ne x y)
; (.lt x y)
; (.gt x y)
; (.le x y)
; (.ge x y)
; (.add x y)
; (.sub x y)
; (.mul x y)
; (.div x y)
; (.rem x y)
; (.sll x y) - shift left logical
; (.srl x y) - shift right logical
; (.sra x y) - shift right arithmetic
; (.bitand x y) - bitwise and
; (.bitor x y) - bitwise or
; (.bitxor x y) - bitwise xor
; (.bitinv x) - bitwise invert
; (.car l)
; (.cdr l)
; (.caar l)
; (.cadr l)
; (.cdar l)
; (.cddr l)



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]