(provide (quote backquote))

(defmacro bq-push (v l) "Pushes evaluated first form onto second unevaluated object
a list-value atom" (byte-code "	EE" [l v setq cons] 5))

(defmacro bq-caar (l) (byte-code "DD" [l car] 3))

(defmacro bq-cadr (l) (byte-code "DD" [l car cdr] 3))

(defmacro bq-cdar (l) (byte-code "DD" [l cdr car] 3))

(defconst backquote-unquote (quote (\,)) "\
*A list of all objects that stimulate unquoting in `.  Memq test.")

(defconst backquote-splice (quote (\,@)) "\
*A list of all objects that stimulate splicing in `.  Memq test.")

(defmacro \` (form) "(` FORM) Expands to a form that will generate FORM.
FORM is `almost quoted' -- see backquote.el for a description." (byte-code "!" [form bq-make-maker] 2))

(defun bq-make-maker (form) "\
Given one argument, a `mostly quoted' object, produces a maker.
See backquote.el for details" (byte-code "
!\"6=D6GU3\"A@\"6B," [tailmaker qc ec state nil form bq-singles t 0 mapcar bq-iterative-list-builder reverse quote 1 funcall assq] 6))

(defconst bq-singles (quote ((quote bq-quotecar) (append car) (list bq-make-list) (cons bq-id))))

(defun bq-id (x) (byte-code "" [x] 1))

(defun bq-quotecar (x) (byte-code "@D" [x quote] 2))

(defun bq-make-list (x) (byte-code "B" [x list] 2))

(defun bq-iterative-list-builder (form) "\
Called by bq-make-maker.  Adds a new item form to tailmaker, 
changing state if need be, so tailmaker and state constitute a recipie
for making the list so far." (byte-code "!	
\"A@\"j@>'	\"A@A@\"j@
>=	\"A@A@\"j!<M@=_	
\"A@A@\"i	\"A@\")" [form state bq-quotefns backquote-unquote bq-evalfns backquote-splice bq-splicefns t newform atom funcall assq bq-make-maker quote] 14))

(defconst bq-splicefns (quote ((nil bq-splicenil) (append bq-spliceappend) (list bq-splicelist) (quote bq-splicequote) (cons bq-splicecons))))

(defconst bq-evalfns (quote ((nil bq-evalnil) (append bq-evalappend) (list bq-evallist) (quote bq-evalquote) (cons bq-evalcons))))

(defconst bq-quotefns (quote ((nil bq-quotenil) (append bq-quoteappend) (list bq-quotelist) (quote bq-quotequote) (cons bq-quotecons))))

(defun bq-quotecons (form) (byte-code "@<@@=	@A@DDA@D,	D@EA@Dʼn" [tailmaker form state quote list append] 3))

(defun bq-quotequote (form) (byte-code "	B" [tailmaker form] 2))

(defun bq-quotelist (form) (byte-code "	DB" [tailmaker form quote] 2))

(defun bq-quoteappend (form) (byte-code "<@<@@=!@A	@A@B\")	CDB" [tailmaker form t quote rplaca] 4))

(defun bq-quotenil (form) (byte-code "	CÉ" [tailmaker form state quote] 2))

(defun bq-evalcons (form) (byte-code "	@EA@Dĉ" [tailmaker form state list append] 3))

(defun bq-evalquote (form) (byte-code "GW	\"Blj#	DDDɉ" [tailmaker form state t 3 mapcar (lambda (x) (byte-code "D" [x quote] 2)) list quote append] 4))

(defun bq-evallist (form) (byte-code "	B" [tailmaker form] 2))

(defun bq-evalappend (form) (byte-code "<@<@@=@	@AB\"9GU2	Blj9	DB" [tailmaker form state t list rplacd 1 cons] 4))

(defun bq-evalnil (form) (byte-code "	CÉ" [tailmaker form state list] 2))

(defun bq-splicecons (form) (byte-code "	@A@EDĉ" [tailmaker form state cons append] 4))

(defun bq-splicequote (form) (byte-code "	CDDĉ" [tailmaker form state quote append] 3))

(defun bq-splicelist (form) (byte-code "	BDĉ" [tailmaker form state list append] 3))

(defun bq-spliceappend (form) (byte-code "	B" [tailmaker form] 2))

(defun bq-splicenil (form) (byte-code "É
C" [state tailmaker form append] 2))