Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
macrologist committed Sep 9, 2024
1 parent f7b8267 commit b6aa471
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/pragmas.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,14 @@ Expected syntax: PRAGMA NON_VOLATILE identifier")

(type
(:WORD)
(:WORD :LEFT-BRACKET :RIGHT-BRACKET
(lambda (word rb lb)
(declare (ignore rb lb))
(list (string-to-quil-type word) '*)))
(:WORD :LEFT-BRACKET :INT :RIGHT-BRACKET
(lambda (word rb size lb)
(declare (ignore rb lb))
(format nil "~a[~a]" word size)))))
(list (string-to-quil-type word) size)))))

(define-pragma "EXTERN" pragma-extern-signature
(:documentation "PRAGMA declaring the function signature of an extern.
Expand All @@ -240,10 +244,13 @@ Expected syntax: PRAGMA EXTERN extern-name \"TYPE? \( (var : mut? TYPE)+ \)")
(setf param-types (getf parsed :param-types)))
(yacc:yacc-parse-error (err)
(warn "Syntax error while parsing PRAGMA EXTERN: ~s~% Error: ~a"
function-signature-string
(princ-to-string err)))
(error (err)
(warn "Error while parsing PRAGMA EXTERN: ~s~% Error: ~a"
function-signature-string
(princ-to-string err))))))


(defun parsed-program-has-pragma-p (parsed-program &optional (pragma-type 'pragma))
"Return T if PARSED-PROGRAM's executable code contains any pragma. Optionally use PRAGMA-TYPE to restrict to a particular pragma type."
(some (a:rcurry #'typep pragma-type)
Expand Down

0 comments on commit b6aa471

Please sign in to comment.