diff options
-rw-r--r-- | main.lisp | 58 |
1 files changed, 38 insertions, 20 deletions
@@ -22,29 +22,47 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA To solve the problem of the colliding syntax rules We can test only the addressin modes we know the opcode to have This not only solves this problem, it just makes more sense. -|# +Need to use the existing lists to find keywords to watch out for during compilation. +ESPECIALLY run through the output of macro-list to find collisions +This owuld make it simple +|# (setf *the-program* (program "~/clasm-6502/wozmon.s")) -(defun macro-list (program-list) - "Create an associative list of program-list macros." - (let ((return-alist nil)) +(defun macro-pass (program-list) + "Translate a programs macros" + (let ((macro-association-list + (let ((return-alist nil)) + (dolist (i program-list) + (if (equal (syntax-rule (cadr i) *grammar*) 'macro) + (setf return-alist + (cons (list (first (cadr i)) (car (last (cadr i)))) + return-alist)) + nil)) + return-alist)) + (return-list nil)) + ;; For every line in program list.. (dolist (i program-list) - (if (equal (syntax-rule (cadr i) *grammar*) 'macro) - (setf return-alist - (cons (list (first (cadr i)) (car (last (cadr i)))) - return-alist)) - nil)) - return-alist)) - -*the-program* - -(macro-list *the-program*) - - -(last (cadr '(100 ("Hey" "There")))) - - -(defun pass-attributes (program-list)) + ;; ..excluding the macro lines.. + (if (eq (syntax-rule (cadr i) *grammar*) 'macro) + nil + ;; ..add to return list this value: + (setf return-list + (cons + ;; For every word in the line, + (let ((append-list nil)) + (dolist (j (cadr i)) + (setf append-list + ;; add it to the output line, and change whatever is a macro. + (cons (if (assoc j macro-association-list :test #'string=) + (cadr (assoc j macro-association-list :test #'string=)) + j) + append-list))) + ;; Return the line number and program. + (cons (car i) + (list (reverse append-list)))) + return-list)))) + ;; Return everything. + (reverse return-list))) |