public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: Doug Evans <dje@sebabeach.org>
To: cgen@sourceware.org
Subject: extending pmacro facility
Date: Sat, 04 Jul 2009 21:05:00 -0000	[thread overview]
Message-ID: <4A4FC42F.2070005@sebabeach.org> (raw)

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)

             reply	other threads:[~2009-07-04 21:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-04 21:05 Doug Evans [this message]
2009-07-04 23:37 ` Dave Korn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A4FC42F.2070005@sebabeach.org \
    --to=dje@sebabeach.org \
    --cc=cgen@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).