Ferreteria/v0.6/sys/Parsing

From Woozle Writes Code
< Ferreteria‎ | v0.6‎ | sys
Jump to navigation Jump to search
Ferreteria: Parsing system v2 (revision in progress)
earlier: v0, v1

About

The parsing system is built on a collection of relatively simple ideas, but keeping them organized so they work well together gets complicated quickly.

Terminology

  • Nucleus (fka "Parser"): has a Strand, an Enzyme, and a Lookup -- equivalent to old "Template"
  • Enzyme: breaks a string up into objects (Codons) that fully represent each section
    • returns a Gene
      • ...which contains zero or more Codons
  • Ribosome (fka "Lookup"): transforms input values into output, typically via a lookup array
  • Strand (fka "template string"): a string formatted in a way that the Enzyme knows how to segment/objectify

Thinking

  • 2025-12-29 Some updated terminological thinks:
    • A codon is a fixed-length segment of a DNA strand. I'm using it for variable-length sequences that are handled differently. (This is probably a very bad metaphor.)
      • I first thought of using "gene" for segment-collections, but the analogy seemed only vaguely applicable and the word "gene" gets a bit overused as a metaphor. Decided to use it for a collection of codons. (Genetic biologists will probably hate me now.)
    • An enzyme and a ribosome are both molecular machines that handle DNA segments like data. Enzymes copy, ribosomes link pieces together. It's a crude fit, but maybe it'll do?
    • A cell's nucleus contains most of its DNA, so that seemed a reasonable name for a collection of codons. (Maybe I should have just called it "codons"...)
      • Decided to use nucleus to represent the top-level clade, fka "Parser".