changelog shortlog graph tags branches files raw help

Mercurial > org > blog / changeset: weekend warrior

changeset 28: 6d54ccb29de4
parent 27: db5ece2206cf
child 29: 3e5bf3bfe44a
author: Richard Westhaver <ellis@rwest.io>
date: Sun, 18 Aug 2024 22:16:12 -0400
files: draft/a-bit-of-risc.org draft/a-lispy-database.org draft/dylib-skel.org draft/hello-world.org draft/on-lisp-ecosystems.org draft/outlines.org
description: weekend warrior
     1.1--- a/draft/a-bit-of-risc.org	Mon Aug 12 18:31:37 2024 -0400
     1.2+++ b/draft/a-bit-of-risc.org	Sun Aug 18 22:16:12 2024 -0400
     1.3@@ -1,6 +1,7 @@
     1.4 #+title: A Bit of RISC
     1.5 #+date: [2024-03-11 Mon]
     1.6 #+setupfile: ../../clean.theme
     1.7+#+property: header-args :eval no-export
     1.8 I recently picked up [[https://dl.acm.org/doi/10.5555/2462741][Hacker's Delight]] and having a lot of fun with
     1.9 it. It's a collection of bit-manipulation tricks collected by hackers
    1.10 over many years. You can flip open pretty much anywhere in the book
    1.11@@ -21,7 +22,13 @@
    1.12 You can find most of the code from the book [[https://github.com/hcs0/Hackers-Delight][here]].
    1.13 
    1.14 * Design
    1.15+:PROPERTIES:
    1.16+:ID:       c030566f-1ede-4edc-b393-d2c6c1c2d19f
    1.17+:END:
    1.18 ** Data Representation
    1.19+:PROPERTIES:
    1.20+:ID:       6d93e084-1047-4a33-adb3-5c90af96ead0
    1.21+:END:
    1.22 We'll be sticking with a 32-bit word length as recommended in the
    1.23 Preface. We will also represent registers as integers whenever
    1.24 possible, instead of say a bit-vector. Without going into too much
    1.25@@ -36,6 +43,9 @@
    1.26 Floating-point support and special purpose registers are not required.
    1.27 
    1.28 ** Instructions
    1.29+:PROPERTIES:
    1.30+:ID:       fb86a212-b49a-44ff-b30b-32c789ca55e2
    1.31+:END:
    1.32 The Hacker's Delight RISC architecture is described in two tables,
    1.33 denoted =basic RISC= and =full RISC= respectively.
    1.34 
    1.35@@ -103,6 +113,9 @@
    1.36 instructions directly to Lisp functions using macros.
    1.37 
    1.38 ** Execution Model
    1.39+:PROPERTIES:
    1.40+:ID:       f84fcd3d-86ad-4b9b-a330-4572d6120559
    1.41+:END:
    1.42 We'll build this machine in Lisp and use plenty intrinsics from
    1.43 SBCL. As a starting point I followed Paul Khuong's excellent blog
    1.44 post: [[https://pvk.ca/Blog/2014/03/15/sbcl-the-ultimate-assembly-code-breadboard/][SBCL: The ultimate assembly code breadboard]].
    1.45@@ -116,6 +129,7 @@
    1.46 * The HAKMEM VM
    1.47 :properties:
    1.48 :header-args: :session t :results none :noeval t
    1.49+:ID:       43484c58-ab29-481c-b2b9-17ab4d91e22f
    1.50 :end:
    1.51 #+name: defpackage
    1.52 #+begin_src lisp
     2.1--- a/draft/a-lispy-database.org	Mon Aug 12 18:31:37 2024 -0400
     2.2+++ b/draft/a-lispy-database.org	Sun Aug 18 22:16:12 2024 -0400
     2.3@@ -1,11 +1,14 @@
     2.4 #+title: A Lispy Database
     2.5 #+options: toc:t h:1
     2.6 #+setupfile: ../../clean.theme
     2.7-
     2.8+#+property: header-args :eval no-export
     2.9 One of the key features missing in the Compiler Company [[https://vc.compiler.company/comp/core][core]] is a
    2.10 reliable [[https://en.wikipedia.org/wiki/Category:Database_management_systems][DBMS]]. It's something that I've worked towards in Rust, and
    2.11 now in Common Lisp, but haven't gotten to a production-ready state.
    2.12 * SQL
    2.13+:PROPERTIES:
    2.14+:ID:       2c0c63ba-93f4-4642-9eb3-76bfe6a786d0
    2.15+:END:
    2.16 [[cdn:media/img/sql-architecture.jpg]]
    2.17 
    2.18 
    2.19@@ -27,19 +30,34 @@
    2.20 and that is where it should remain according to the CC.
    2.21 
    2.22 * Prolog
    2.23+:PROPERTIES:
    2.24+:ID:       a9fa63a6-7427-4f59-8bee-326f74f9a247
    2.25+:END:
    2.26 
    2.27 #+ATTR_HTML: :width 50%
    2.28 [[cdn:media/img/wam.webp]]
    2.29 
    2.30 * Key-Value Stores
    2.31+:PROPERTIES:
    2.32+:ID:       95bef557-d894-4b9e-ab80-c47cd4d9fa2e
    2.33+:END:
    2.34 ** RocksDB
    2.35+:PROPERTIES:
    2.36+:ID:       d4d3ad7f-8bd1-4471-b82b-f7a26d7ac050
    2.37+:END:
    2.38 [[cdn:media/img/rocksdb.png]]
    2.39 ** Blobs
    2.40+:PROPERTIES:
    2.41+:ID:       5d0c299e-3efe-4d87-a897-153760fe31f4
    2.42+:END:
    2.43 
    2.44 #+ATTR_HTML: :width 50%
    2.45 [[cdn:media/img/blob.jpg]]
    2.46 
    2.47 * Objects
    2.48+:PROPERTIES:
    2.49+:ID:       b98858f9-66bb-4e41-bd84-23e6579fde7b
    2.50+:END:
    2.51 
    2.52 https://courses.cs.northwestern.edu/325/readings/clos.html
    2.53 
     3.1--- a/draft/dylib-skel.org	Mon Aug 12 18:31:37 2024 -0400
     3.2+++ b/draft/dylib-skel.org	Sun Aug 18 22:16:12 2024 -0400
     3.3@@ -1,6 +1,7 @@
     3.4 #+title: Shared Library Skeletons
     3.5 #+setupfile: ../../clean.theme
     3.6 #+header-args: :eval never
     3.7+#+property: header-args :eval no-export
     3.8 * Overview
     3.9 :PROPERTIES:
    3.10 :ID:       748ba6e4-60db-4ff7-9d78-12c3f67644d8
     4.1--- a/draft/hello-world.org	Mon Aug 12 18:31:37 2024 -0400
     4.2+++ b/draft/hello-world.org	Sun Aug 18 22:16:12 2024 -0400
     4.3@@ -1,7 +1,11 @@
     4.4 #+title: (hello world)
     4.5 #+options: toc:t h:1
     4.6 #+setupfile: ../../clean.theme
     4.7+#+property: header-args :eval no-export
     4.8 * COMMENT Introduction
     4.9+:PROPERTIES:
    4.10+:ID:       c9766ba7-319d-49f3-868e-8e289dbf5b3b
    4.11+:END:
    4.12 Hello World,
    4.13 
    4.14 I've worked in and around software systems for many years. Throughout
    4.15@@ -37,6 +41,9 @@
    4.16 align with.
    4.17 
    4.18 * COMMENT The Compiler Company
    4.19+:PROPERTIES:
    4.20+:ID:       ae6e6d60-e7c7-4efa-9136-26ad262a55b3
    4.21+:END:
    4.22 Without further ado, I'd like to announce /The Compiler Company,
    4.23 LLC/. The purpose of /The Compiler Company/ is to /compile/
    4.24 /companies/.
    4.25@@ -58,6 +65,9 @@
    4.26 for internal benchmarking.
    4.27 
    4.28 ** [[https://compiler.company/docs/core][core]]
    4.29+:PROPERTIES:
    4.30+:ID:       f64eb994-2a5e-4f7b-90c4-e6c29e321791
    4.31+:END:
    4.32 The =core= is a collection of applications and libraries built from
    4.33 the bottom-up with modularity in mind. It's primarily written in
    4.34 Common Lisp and Rust with minimal external dependencies.
    4.35@@ -79,6 +89,9 @@
    4.36 environment in parallel to Lisp.
    4.37 
    4.38 ** [[https://compiler.company/docs/infra][infra]]
    4.39+:PROPERTIES:
    4.40+:ID:       3c6bd04c-1da6-43d0-8d5c-bb267ada3f7a
    4.41+:END:
    4.42 Unfortunately, ideas can't host themselves. We need a robust
    4.43 infrastructure to compensate for this. The project =infra= contains
    4.44 scripts for building and maintaing the entire corporate
     5.1--- a/draft/on-lisp-ecosystems.org	Mon Aug 12 18:31:37 2024 -0400
     5.2+++ b/draft/on-lisp-ecosystems.org	Sun Aug 18 22:16:12 2024 -0400
     5.3@@ -1,1 +1,2 @@
     5.4 #+setupfile: ../../clean.theme
     5.5+#+property: header-args :eval no-export
     6.1--- a/draft/outlines.org	Mon Aug 12 18:31:37 2024 -0400
     6.2+++ b/draft/outlines.org	Sun Aug 18 22:16:12 2024 -0400
     6.3@@ -1,6 +1,10 @@
     6.4 #+title: outlines
     6.5 #+setupfile: ../../clean.theme
     6.6+#+property: header-args :eval no-export
     6.7 * Overview
     6.8+:PROPERTIES:
     6.9+:ID:       f49fa8a0-39a6-4a5f-8fb6-8d4086ea5476
    6.10+:END:
    6.11 Source code files are hard to manage. They can get unwieldly quickly and making the
    6.12 wrong assumption about your whereabouts in the code tree can have unintended
    6.13 consequences.
    6.14@@ -33,6 +37,9 @@
    6.15 structure of a source code file.
    6.16 
    6.17 * Outlines
    6.18+:PROPERTIES:
    6.19+:ID:       651aa74f-e634-4eac-8292-95efbe2aab9c
    6.20+:END:
    6.21 Like all my good ideas, this one is credited entirely to Emacs. In this case, the
    6.22 excellent [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Outline-Mode.html][Outline mode]]. If you are an Emacs user you've probably already used it without
    6.23 knowing -- Org mode, for example, is [[https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/org.el?h=release_9.6.9#n4789][derived from outline-mode]].
    6.24@@ -48,6 +55,9 @@
    6.25 -- [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Outline-Mode.html][GNU]]
    6.26 
    6.27 ** Quickstart
    6.28+:PROPERTIES:
    6.29+:ID:       8e1927c5-5e2b-470a-9249-5fe0e375451c
    6.30+:END:
    6.31 If you want to jump in right away, I recommend using these keybinds in Emacs:
    6.32 
    6.33 #+tblname: outline-keys
    6.34@@ -73,6 +83,9 @@
    6.35 move around the file with the new keybinds above.
    6.36 
    6.37 ** Outlines4All
    6.38+:PROPERTIES:
    6.39+:ID:       0751feb7-7e44-44d3-befd-905d365d05a1
    6.40+:END:
    6.41 Not all programming modes have outline support built-in. The good news is that it's easy
    6.42 to enable it.
    6.43 
    6.44@@ -80,6 +93,9 @@
    6.45 =outline-minor-mode=.
    6.46 
    6.47 *** Using dir-locals
    6.48+:PROPERTIES:
    6.49+:ID:       cf39a556-fc2c-46e3-a2f7-e659213a915f
    6.50+:END:
    6.51 The way it's done in the NAS-T codebase is with a [[../../.dir-locals.el][.dir-locals.el]] file.
    6.52 
    6.53 You just need to add this form for the mode of your choice, replacing the string
    6.54@@ -94,6 +110,9 @@
    6.55 minor-mode separately though. For project-level support, that's all there is to it.
    6.56 
    6.57 *** Using init.el
    6.58+:PROPERTIES:
    6.59+:ID:       c76e4c71-c77a-43b6-811c-0a83981a1dc5
    6.60+:END:
    6.61 You may also modify your config to enable =outline-minor-mode= for select major-modes at
    6.62 startup. Here's a quick example from my config:
    6.63 
    6.64@@ -124,9 +143,15 @@
    6.65 ;;; outline-cfg.el ends here
    6.66 #+end_src
    6.67 ** Default Sections
    6.68+:PROPERTIES:
    6.69+:ID:       c912d356-9688-4d48-91a8-ae234b410d46
    6.70+:END:
    6.71 Our default sections should look familiar - they're just Emacs Lisp defaults, with a few
    6.72 choice extensions.
    6.73 *** Source Header
    6.74+:PROPERTIES:
    6.75+:ID:       6e5856f0-3d75-4a4d-b44d-35e9015a63ab
    6.76+:END:
    6.77 First line of every source code file.
    6.78 
    6.79 Here is the prototype in lisp:
    6.80@@ -141,13 +166,22 @@
    6.81 
    6.82 etc.
    6.83 **** Metadata                                                   :optional:
    6.84+:PROPERTIES:
    6.85+:ID:       56e5ccd3-b98a-4ba0-aaaa-eef49bc3fac7
    6.86+:END:
    6.87 Some files may insert a blank line and start the =Code= heading, while others will
    6.88 include some additional information about the file such as a long-description, version,
    6.89 list of exports, etc.
    6.90 *** Commentary                                                   :optional:
    6.91+:PROPERTIES:
    6.92+:ID:       a8e36d82-4788-422c-af83-3374f23f9dc9
    6.93+:END:
    6.94 An optional programmer commentary included in source code files after the =Source
    6.95 Header= but before the =Code=. The contents are unpredictable but may include notes,
    6.96 todos, diagrams, stack notations, test results, links, tips, etc.
    6.97 *** Code
    6.98+:PROPERTIES:
    6.99+:ID:       7422d382-450b-46d6-898f-42daae455a47
   6.100+:END:
   6.101 The =Code= heading should be the final toplevel heading of any source code file. You
   6.102 may see a number of sub-headings, starting with four or more comment chars.