[GoLUG] [parse] I just discovered my first practical information

Steve Litt slitt at troubleshooters.com
Sun Nov 12 18:28:45 EST 2023


Hi all,

A few minutes of study on the Backus–Naur form (BNF) is applicable only
to context-free grammars, not context-sensitive grammars. A little back
and forth with Chat GTP showed me that, for practical purposes,
context-free only works on one line at a time, whereas if you need to
parse depending on what came before, you need to change parsing rules
depending on what came before, that requires context-sensitive grammar,
which is much more complicated. A little more discussion is that a
common way of getting around this is to substitute a token for every
newline, and then parse the whole paragraph as a whole, which can be
done context-free.

Of course this still leaves in question how to handle things like
source code in documentation, where the entire source code block must
be handled as a single line in order to keep things context-free. I'm
sure one of us will know or stumble across the solution to the source
code documentation later.

SteveT

Steve Litt 

Autumn 2023 featured book: Rapid Learning for the 21st Century
http://www.troubleshooters.com/rl21



More information about the GoLUG mailing list