changeset 14: |
2bbf5ce73537 |
parent 13: |
1fedeaa5bfc5 |
child 15: |
e8eb5754d201 |
author: |
ellis <ellis@rwest.io> |
date: |
Tue, 23 May 2023 20:43:02 -0400 |
files: |
makefile readme.org rs.lisp tk.lisp |
description: |
rs updates |
1.1--- a/makefile Fri May 19 22:38:49 2023 -0400
1.2+++ b/makefile Tue May 23 20:43:02 2023 -0400
1.3@@ -1,12 +1,10 @@
1.4-M ?= release
1.5-L ?= sbcl
1.6-P ?= python3
1.7-
1.8+M ?= release #mode
1.9+L ?= sbcl #lisp
1.10+P ?= python3 #python
1.11 RS:Cargo.toml build.rs lib.rs obj fig
1.12 CL:*.asd *.lisp
1.13-.PHONY:build
1.14 clean:;rm -rf *.fasl;cargo clean
1.15-fmt:;cargo fmt
1.16+fmt:$(RS);cargo fmt
1.17 build:$(RS) $(CL);cargo build --$(M);$L install.lisp
1.18 ffi:build;cp target/$(M)/libdemo.dylib ffi;cd ffi;$(P) ffi/build.py
1.19 docs:$(RS);cargo doc
1.20@@ -14,3 +12,4 @@
1.21 #pack:;scripts/pack.ros
1.22 #check:;scripts/check.ros
1.23 ci:clean fmt build ffi docs test;
1.24+.PHONY:build
2.1--- a/readme.org Fri May 19 22:38:49 2023 -0400
2.2+++ b/readme.org Tue May 23 20:43:02 2023 -0400
2.3@@ -1,11 +1,33 @@
2.4 #+TITTLE: cl-demo
2.5 This is a demo software suite which showcases the power of Common Lisp and Rust.
2.6-* Make
2.7-* Run
2.8-* Play
2.9-* Config
2.10+* Guide
2.11+** Build
2.12+- *install dependencies*
2.13+ - Rust =curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh=
2.14+ - Common Lisp
2.15+ - on Linux ::
2.16+ - Ubuntu/Debian :: =sudo apt-get install sbcl=
2.17+ - Arch BTW :: =sudo pacman -S sbcl=
2.18+ - on MacOS :: =brew install sbcl=
2.19+ - on Windows :: download from
2.20+ <https://www.sbcl.org/platform-table.html> and figure it out.
2.21+ - Quiche
2.22+ - RocksDB
2.23+- *make executables* \\
2.24+ Simply run =make build=. Read the ~makefile~ and change the options
2.25+ as needed.
2.26+- M :: Mode (debug, release)
2.27+- L :: Lisp (sbcl, cmucl, ccl)
2.28+- P :: Python (python3, python2)
2.29+** Run
2.30+=./demo=
2.31+** Config
2.32+This demo features a novel configuration language inspired by
2.33+FORTH. You are free to use ~.fig~ files, but also have the option to
2.34+use a convention format (JSON,TOML,RON).
2.35+** Play
2.36+*** Weather
2.37 * tasks
2.38-** TODO ros scripts
2.39 ** TODO DSLs
2.40 - consider tree-sitter parsing layout, use as a guide for developing a
2.41 single syntax which expands to Rust or C.
2.42@@ -21,6 +43,7 @@
2.43 - rs-macros
2.44 - rs-macroexpand
2.45 - rs-macroexpand-1
2.46+
2.47 *** TODO c-macroexpand
2.48 - c-gen-file h/c
2.49 - c-defmacro
3.1--- a/rs.lisp Fri May 19 22:38:49 2023 -0400
3.2+++ b/rs.lisp Tue May 23 20:43:02 2023 -0400
3.3@@ -1,9 +1,22 @@
3.4 ;;; RUST DSL
3.5+
3.6+;; So basically, this was born out of personal frustration with how
3.7+;; cbindgen and Rust macros work (they don't). Rust macros in general
3.8+;; are something of a pain in my opinion, so I thought why not just
3.9+;; generate Rust code from Lisp instead?
3.10+
3.11 (in-package :demo)
3.12
3.13 (defvar *cargo-target* #p"/Users/ellis/dev/otom8/demo/target/")
3.14 (defvar *rs-macros* nil)
3.15
3.16+;; TODO gensyms
3.17+(defmacro rs-defmacro (name args &body body)
3.18+ "Define a macro which can be used within the body of a 'with-rs' form."
3.19+ `(prog1
3.20+ (defmacro ,name ,@(mapcar #`(,a1) args) ,@body)
3.21+ (push ',name *rs-macros*)))
3.22+
3.23 (defun rs-mod-form (crate &optional mods pub)
3.24 "Generate a basic mod form (CRATE . [MODS] [PUB])"
3.25 `(,crate ,mods ,pub))
3.26@@ -61,10 +74,5 @@
3.27 ;; (defun rs-macroexpand-1 (form &optional env))
3.28
3.29 ;; (defun rs-macroexpand (env &rest body)
3.30-;; "Cbindgen is quite the menace and really doesn't like our macros used
3.31-;; to generate C FFI bindings. To compensate for this, we use a tool
3.32-;; called cargo-expand by the most excellent dtolnay which expands Rust
3.33-;; macros. The expansions are assembled into an equivalent Rust source
3.34-;; file which cbindgen won't get stuck in an infinite compile loop on.")
3.35
3.36 ;;;
4.1--- a/tk.lisp Fri May 19 22:38:49 2023 -0400
4.2+++ b/tk.lisp Tue May 23 20:43:02 2023 -0400
4.3@@ -23,6 +23,6 @@
4.4 ,(funcall
4.5 (get-macro-character #\`) stream nil)))
4.6
4.7-(eval-when (:execute)
4.8+(eval-when (:load-toplevel)
4.9 (set-dispatch-macro-character
4.10 #\# #\` #'demo:sbq-reader))