Skip to content

Commit 2181d56

Browse files
committed
finishing out decadv
1 parent c9a862d commit 2181d56

2 files changed

Lines changed: 157 additions & 4 deletions

File tree

content-org/garden/december-adventure.org

Lines changed: 157 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@ Found out about the December adventure on Mastodon (likely from folks over at
1010
better late than never. Here's a bit [[https://eli.li/december-adventure][about it]], but the idea is just to pick a
1111
project or a few, work on them, and log your progress.
1212

13-
I've taken the liberty of retroactively logging the days I missed.
13+
Now that December's over, I've written a short [[retrospective][retrospective]] at the bottom of
14+
the page.
1415

1516
#+ATTR_HTML: :class calendar-table
1617
| 日 | 月 | 火 | 水 | 木 | 金 | 土 |
1718
|----+----+----+----+----+----+----|
18-
| | [[december 1][01]] | [[december 2 - 3][02]] | [[december 2 - 3][03]] | [[december 4][04]] | [[december 5][05]] | [[december 6][06]] |
19+
| | 01 | 02 | 03 | [[december 4][04]] | [[december 5][05]] | [[december 6][06]] |
1920
| [[december 7][07]] | [[december 8][08]] | [[december 9][09]] | [[december 10][10]] | [[December 11][11]] | [[december 12][12]] | [[december 13][13]] |
20-
| [[december 14-18][14]] | [[december 14-18][15]] | [[december 14-18][16]] | [[*december 14-18][17]] | [[december 14-18][18]] | [[december 19][19]] | [[december 20][20]] |
21+
| 14 | 15 | 16 | 17 | 18 | [[december 19][19]] | [[december 20][20]] |
2122
| [[december 21][21]] | 22 | 23 | 24 | 25 | 26 | 27 |
22-
| 28 | 29 | 30 | 31 | | | |
23+
| 28 | 29 | [[december 30][30]] | [[december 31][31]] | | | |
2324

2425
* december 1
2526
Traveling back from Tokyo. I'm not very good at getting things done on the
@@ -807,6 +808,158 @@ Things are getting busy as the end of December approaches, so I don't know if
807808
I'll be able to get to it... but it would be great to learn enough about
808809
tree-sitter grammars to submit a patch.
809810

811+
* december 22-29
812+
Busy playing mahjong (both riichi and filipino) with family, no adventuring.
813+
814+
* december 30
815+
Obtained a hand-me-down 35mm film camera! It's a 1969 Nikon F (apparently a
816+
legendary SLR) with a 55mm f/1.2 lens. Here's a picture of it, taken with my
817+
Fujifilm X-S10:
818+
819+
#+ATTR_HTML: :alt a vintage film camera sits among scattered mahjong tiles
820+
[[file:images/december-adventure-2025/nikon-f.jpg]]
821+
822+
I'm still very new to photography, so using a fully manual camera with no
823+
feedback until the films are developed is probably not a great idea. On the
824+
other hand, sometimes being thrown into the deep end can be a good way to learn
825+
a new hobby quickly. I picked up 2 rolls of Fujifilm 200 and I've been taking a
826+
few photos -- probably horribly underexposed. The viewfinder on the camera had a
827+
mercury-battery powered light meter but the batteries are of course long dead
828+
(I've read that these light meters tend to become inaccurate after so many
829+
years anyway), so I'm currently using a light meter app on my phone to estimate
830+
what my shutter speeds should be.
831+
832+
I hope the pictures I've been taking actually come out okay. The worst would be
833+
to for the film to be completely blank or something when I get it developed. I
834+
am fairly confident that the camera's functioning fine, though. The Nikon F is
835+
incredibly robust (full metal construction) to the point that there are stories
836+
of it deflecting bullets in war zones. Having grown up with digital cameras and
837+
rechargeable batteries, it's amazing that a bit of chemically treated paper
838+
together with a purely mechanical contraption of metal and mirrors can take such
839+
incredible photos.
840+
841+
If the first roll comes out alright, I'm hoping to use the Nikon F to learn the
842+
basics of film photography over the next few months. It's quite heavy
843+
(especially when you're used to a modern mirrorless with a small prime lens), so
844+
I probably won't be travelling with it. Instead, I might try to just document
845+
everyday life. Given how many photos I take while traveling, it's probably for
846+
the better anyway -- film is an expensive hobby...
847+
848+
To keep track of my photography learnings (be it digital or film), I've started
849+
a [[https://pixelfed.social/knees][Pixelfed account]]. It's currently a bit bare, but I'll start working through my
850+
old RAWs and posting the ones I'm proud of.
851+
852+
* december 31
853+
Let's take a look at the tree-sitter =grammar.js= for =uxntal=, which can be found at
854+
the top-level of the repository [[https://github.com/tree-sitter-grammars/tree-sitter-uxntal][here]]. The structure is fairly straightforward
855+
(see also the [[https://tree-sitter.github.io/tree-sitter/creating-parsers/2-the-grammar-dsl.html][documentation]]). The snippet
856+
#+begin_src js
857+
rules: {
858+
program: $ => repeat(
859+
choice(
860+
$.macro,
861+
$.include,
862+
$.memory_execution,
863+
$.subroutine,
864+
),
865+
),
866+
#+end_src
867+
specifies (using =repeat= and =choice=) that a program consists of
868+
arbitrary sequences of the four specified nodes. These nodes must in turn be
869+
defined. The memory execution node, for example, consists of an absolute pad
870+
operation followed by an arbitrary sequence of non-toplevel-statements (which
871+
must be defined as well):
872+
#+begin_src js
873+
memory_execution: $ => seq(
874+
$.absolute_pad_operation,
875+
repeat($._non_toplevel_statement),
876+
),
877+
#+end_src
878+
The absolute pad operation, in turn, is just the symbol "|" followed by a
879+
number (which is described by regex as a 1- to 4-digit hexadecimal):
880+
#+begin_src js
881+
absolute_pad_operation: $ => seq('|', $.number),
882+
number: _ => /[\da-f]{1,4}\s/,
883+
#+end_src
884+
885+
In order to test out changes to the grammar we need to ensure that the tree-sitter
886+
command-line interface is installed. Then, in the project directory, we can run
887+
#+begin_src sh
888+
tree-sitter generate
889+
#+end_src
890+
to generate the parser from the modified =grammar.js=, and
891+
#+begin_src sh
892+
tree-sitter parse source.tal
893+
#+end_src
894+
to display the syntax tree for a file =source.tal=.
895+
896+
The =tree-sitter-uxntal= repository comes with a folder of =uxntal= code examples,
897+
but I think they're a bit old. I put together my own folder of examples
898+
consisting of the =projects/examples= from the =uxn= repository, together with the
899+
examples shown (via wasm?) on the =uxntal= [[https://wiki.xxiivv.com/site/uxntal.html][homepage]]. These programs should be safe
900+
to assume as "valid" (I understand that there's no such thing as an invalid
901+
=uxntal= program, but there seems to be a fairly conventional coding style that
902+
=tree-sitter= should be able to understand). I then ran
903+
#+begin_src sh
904+
tree-sitter parse examples/**/*.tal
905+
#+end_src
906+
to parse all the source files I'd collected. You can also add the =-q= flag if
907+
you're only interested in parse errors.
908+
909+
I got a whole bunch of errors, mostly to do with the usage of angle brackets in
910+
label names, but also the syntax of anonymous labels ={ }=. If we take a look at
911+
the definition of =label= in our grammar, we'll see that it refers to =identifier=,
912+
which is in turn defined by
913+
#+begin_src js
914+
identifier: _ => token(prec(-1, /[0-9]?[a-zA-Z_:*/][/]*[a-zA-Z0-9_:#*\-]*/)),
915+
#+end_src
916+
which you'll notice does not permit angle brackets. I'm no regex expert but I
917+
think we can fix this by throwing in =<>= both before and after a sublabel =/= as
918+
#+begin_src js
919+
identifier: _ => token(prec(-1, /[0-9]?[a-zA-Z_:<>*/][/]*[a-zA-Z0-9_:#<>*\-]*/)),
920+
#+end_src
921+
For the anonymous labels we can introduce some new syntax
922+
#+begin_src js
923+
anonymous_label: $ => seq(
924+
'{',
925+
repeat($._non_toplevel_statement),
926+
'}',
927+
),
928+
#+end_src
929+
and then add in the anonymous label into the list of non-toplevel-statements.
930+
931+
These two are not the only errors (and my solutions are probably not even 100%
932+
correct), but this is roughly how I'm approaching modifying the grammar. I've
933+
been playing with this in between end-of-year holiday busyness, so I hope
934+
to get some time soon to sit down and attack this more seriously.
935+
936+
* retrospective
937+
I'm really glad I did the december adventure this year. It gave me a healthy bit
938+
of motivation to work on or learn about things that I'm interested in but often
939+
don't have the energy to get around to. One of the big takeaways is that I'm
940+
easily nerd-sniped by all sorts of different cool things, which leads me to
941+
starting a lot of projects. Here's a list of things I got interested enough in
942+
to start (or at least write about) this month:
943+
- photography and editing photos
944+
- the kakuji script from the japanese edo period
945+
- basic graphics programming with raylib in c
946+
- writing my own static site generator to move away from the complexity of
947+
hugo and org-mode
948+
- learning the very basics of my first assembly/stack language uxntal
949+
- learning about the tree-sitter parser generator library and its grammars
950+
- an emacs tree-sitter major mode for uxntal
951+
It's tough to focus on a single idea and actually complete a project with a
952+
work-fried brain split among chores and errands.
953+
954+
With these observations in mind... in 2026 I'd like to:
955+
- continue adding to this digital garden/memex. It's a bit of a different format
956+
from the december adventure, but I'd like to continue recording small bits of
957+
things I find interesting, daily if possible
958+
- start more creative projects! Do more photography, learn the basics of
959+
sketching/drawing, write a tiny game, ...
960+
- try to focus on finishing projects. Not necessarily right away (breaks are
961+
good), but eventually. Even if the project scopes are tiny!
962+
810963
-----
811964

812965
Down here I'm collecting the little project ideas that tend to pop into
117 KB
Loading

0 commit comments

Comments
 (0)