Slow Learner Quest

Dev Log #3

I took a little break from development, but the next action on the roadmap was enabling note taking. The app would allow users to track their book reading through sessions, which opens up a timer and a scratchpad to jot down notes and thoughts. Afterwards, the scratchpad would split into different notes based on headers that the user can later reflect on. That means that the scratchpad can be thought of as a tree - there will be multiple nodes/notes branching from different headings.

The initial plans for the app was to create Markdown notes, and I wanted to create formatting based on syntax. My Mastodon posts detailed my journey (also you can follow me here!) where I created some basic parsing units, such as Literal and Match. I had to give it up for the time being due to complexity but I still think it's worthwhile to write about it.

The Foundation framework provides NSScanner or Scanner, which has backtracking to maintain the position of the parsed string. But my research showed that some key methods were deprecated so I felt hesitant to move forward with it. TextMarkupKit initially gave me the idea to create a Packrat Parser, but I had trouble using their text editor.

In the future, I may write more about this if I implement a parsing grammar in the future. In the meantime, if you want to try it yourself, these links may be prove useful:

  1. Guido van Rossum's PEG Parsing Series
  2. String parsing in Swift
  3. NSScanner
  4. Patterns
  5. Packrat Parsing from Scratch
  6. MarkdownParser.swift

#devlog