Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.programming > #16874

What I'm programming

From ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups comp.programming
Subject What I'm programming
Date 2026-01-30 15:35 +0000
Organization Stefan Ram
Message-ID <programming-20260130161720@ram.dialup.fu-berlin.de> (permalink)

Show all headers | View raw


  So, right now I'm programming a /plain text formatter/
  (e.g., something like RUNOFF).

  I already have a paragraph wrapper and a hyphenator
  (for English and German), but so far one needed to write
  custom code to use them.

  Now, I am writing a little input language. I already had
  implemented a syntactic framework before that can parse
  text into a tree (AST)

  So what I actually implemented today was the step from the
  input to a representation with codes for line breaks.

  For example, my program now accepts this input:

< &paragraphs
  < &par 
    < &segment [This is an example.] >
    >
  >

  and generates this output:

< &paragraphs
  < &parlist
    "This"
    [' ', ['', '']]
    "is"
    [' ', ['', '']]
    "an"
    [' ', ['', '']]
    "example."
    [' ', ['', '']]
    >>

  . The "[' ', ['', '']]" can be understood by the wrapper as a space
  with an option to break the line there.

  Disclaimer: The intermediate representation shown as "output"
  above is a data structure (a tree) and its debug output by my
  program was edited for this post to make it more readable.

  Possible continuation of my work: In a next session I might take
  the above output and transform it into the exact format my paragraph
  wrapper requires as input, so that I then can actually feed my
  paragraph to my wrapper. Hyphenation will only be implemented later.

Back to comp.programming | Previous | Next | Find similar


Thread

What I'm programming ram@zedat.fu-berlin.de (Stefan Ram) - 2026-01-30 15:35 +0000

csiph-web