public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
* extending pmacro facility
@ 2009-07-04 21:05 Doug Evans
  2009-07-04 23:37 ` Dave Korn
  0 siblings, 1 reply; 2+ messages in thread
From: Doug Evans @ 2009-07-04 21:05 UTC (permalink / raw)
  To: cgen

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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: extending pmacro facility
  2009-07-04 21:05 extending pmacro facility Doug Evans
@ 2009-07-04 23:37 ` Dave Korn
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Korn @ 2009-07-04 23:37 UTC (permalink / raw)
  To: Doug Evans; +Cc: cgen

Doug Evans wrote:
> [I'm a bit ambivalent on cadr, etc.]

  Would it make sense to have an interface that given the right string of 'a's
and 'd's generates the required definition on the fly and just leave it to the
apps which ones they want to instantiate?


    cheers,
      DaveK

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-07-04 23:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-04 21:05 extending pmacro facility Doug Evans
2009-07-04 23:37 ` Dave Korn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).