X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/7de8c6661211bce3a2b2739b461f33a370294979..2d8d81c52aded8f15e37b061971d493742f55751:/src/codegen-proto.lisp?ds=sidebyside diff --git a/src/codegen-proto.lisp b/src/codegen-proto.lisp index 186f225..e663fb5 100644 --- a/src/codegen-proto.lisp +++ b/src/codegen-proto.lisp @@ -247,6 +247,8 @@ ;; Special kinds of expressions. (definst call (stream :export t) (#1=#:func &rest args) (format stream "~A(~@<~{~A~^, ~_~}~:>)" #1# args)) +(definst cond (stream :export t) (#1=#:cond conseq alt) + (format stream "~@<~A ~2I~@_~@~:>" #1# conseq alt)) ;; Simple statements. (definst return (stream :export t) (#1=#:expr) @@ -320,6 +322,11 @@ (write-string "do" stream)) (format stream "while (~A);" #1#)) +(definst for (stream :export t) (init #1=#:cond update body) + (format-compound-statement (stream body) + (format stream "for (~@<~@[~A~];~@[ ~_~A~];~@[ ~_~A~]~:>)" + init #1# update))) + ;;;-------------------------------------------------------------------------- ;;; Code generation.