Skip to content

Commit

Permalink
[61_7] Goldfish: add keywords for v17.10.5
Browse files Browse the repository at this point in the history
  • Loading branch information
da-liii authored Sep 2, 2024
1 parent 37c4eff commit a09748e
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 13 deletions.
20 changes: 7 additions & 13 deletions TeXmacs/plugins/goldfish/progs/code/goldfish-lang.scm
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,8 @@
(texmacs-module (code goldfish-lang)
(:use (prog default-lang)
(code r7rs-keyword)
(code srfi-keyword)))

(define (liii-keywords)
'("==" "!=" "in?" "display*" "list-view" "argv"
"mkdir" "chdir" "rmdir" "getcwd" "listdir" "getenv" "putenv" "unsetenv"
"getlogin" "getpid" "access" "system" "os-linux?" "os-macos?" "os-windows?"))
(code srfi-keyword)
(code liii-keyword)))

(tm-define (parser-feature lan key)
(:require (and (== lan "goldfish") (== key "identifier")))
Expand All @@ -30,7 +26,7 @@
(tm-define (parser-feature lan key)
(:require (and (== lan "goldfish") (== key "keyword")))
`(,(string->symbol key)
(extra_chars "?" "+" "-" "." "!" "*" ">" "=" "<" "#")
(extra_chars "?" "+" "-" "." "!" "*" ">" "=" "<" "#" "/")
(constant
,@(r7rs-keywords-constant)
"pi" "*stdin*" "*stdout*" "*stderr*"
Expand All @@ -39,10 +35,10 @@
"*missing-close-paren-hook*")
(declare_type
,@(r7rs-keywords-define)
"defined?" "define-macro" "define-constant" "autoload" "require"
"provide" "define*" "lambda*" "eval-string" "let1")
,@(liii-keywords-define))
(keyword
,@(r7rs-keywords-others) ,@(srfi-1-keywords) ,@(srfi-8-keywords) ,@(srfi-13-keywords) ,@(srfi-60-keywords) ,@(srfi-78-keywords)
,@(r7rs-keywords-others) ,@(srfi-1-keywords) ,@(srfi-8-keywords) ,@(srfi-13-keywords) ,@(srfi-60-keywords)
,@(srfi-78-keywords) ,@(srfi-125-keywords) ,@(srfi-133-keywords)
,@(liii-keywords)

; S7 built-ins
Expand All @@ -60,9 +56,7 @@
"syntax-error" "wrong-type-arg" "immutable-error" "out-of-range" "division-by-zero"
"unbound-variable" "read-error" "format-error" "missing-method" "out-of-memory"
"bad-result" "no-catch" "wrong-number-of-args" "io-error" "bignum-error"
; (liii error)
"os-error" "file-not-found-error" "not-a-directory-error" "file-exists-error" "timeout-error"
"type-error" "value-error" "???" "not-implemented-error")
,@(liii-keywords-error))
(keyword_conditional ,@(r7rs-keywords-branch))
(keyword_control ,@(r7rs-keywords-exception) "catch")))

Expand Down
64 changes: 64 additions & 0 deletions TeXmacs/plugins/goldfish/progs/code/liii-keyword.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; MODULE : liii-keyword.scm
;; DESCRIPTION : keywords for the Goldfish Scheme Language
;; COPYRIGHT : (C) 2024 Darcy Shen
;;
;; This software falls under the GNU general public license version 3 or later.
;; It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
;; in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(texmacs-module (code liii-keyword))

(define (liii-base)
(map symbol->string
'(== != display* in? compose identity)))

(define (liii-check)
(map symbol->string
'(test check check-set-mode! check-catch check-report
check-failed? check-true check-false)))

(define (liii-list)
(map symbol->string
'(list-view flatmap list-null? list-not-null? not-null-list?)))

(define (liii-os)
(map symbol->string
'(os-arch os-type os-windows? os-linux? os-macos? os-temp-dir
os-call system mkdir chdir rmdir getenv unsetenv getcwd
listdir access getlogin getpid)))

(define (liii-queue)
(map symbol->string
'(queue queue? queue-empty? queue-size queue-front queue-back
queue-pop! queue-push! queue->list)))

(define (liii-stack)
(map symbol->string
'(stack stack? stack-empty? stack-size stack-top
stack-push! stack-pop! stack->list)))

(define (liii-sys)
(map symbol->string '(argv)))

(define (liii-uuid)
(map symbol->string '(uuid4)))


(tm-define (liii-keywords)
`(,@(liii-base) ,@(liii-check) ,@(liii-list) ,@(liii-os) ,@(liii-queue)
,@(liii-stack) ,@(liii-sys) ,@(liii-uuid)))

(tm-define (liii-keywords-define)
(map symbol->string
'(let1 typed-lambda defined? define-macro define-constant
autoload require provide define* lambda* eval-string case*)))

(tm-define (liii-keywords-error)
(map symbol->string
'(os-error file-not-found-error not-a-directory-error file-exists-error
timeout-error type-error value-error ??? not-implemented-error)))
18 changes: 18 additions & 0 deletions TeXmacs/plugins/r7rs/progs/code/srfi-keyword.scm
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,21 @@
(list
"srfi-78" ; Light-weighted Test framework
"check" "check-set-mode!" "check-report" "check-reset!"))

(tm-define (srfi-125-keywords)
(map symbol->string
'(make-hash-table hash-table hash-table-unfold alist->hash-table
hash-table? hash-table-contains? hash-table-empty? hash-table=?
hash-table-mutable?
hash-table-ref hash-table-ref/default
hash-table-set! hash-table-delete! hash-table-intern! hash-table-update!
hash-table-update!/default hash-table-pop! hash-table-clear!
hash-table-size hash-table-keys hash-table-values hash-table-entries
hash-table-find hash-table-count)))

(tm-define (srfi-133-keywords)
(map symbol->string
'(vector-empty? vector-count
vector-any vector-every vector-copy vector-copy!
vector-index vector-index-right vector-partition
vector-swap!)))

0 comments on commit a09748e

Please sign in to comment.