logo
Published on KernelTrap (http://kerneltrap.org)

Syntax highlighting (oh, that handcrafted programming)

By olecom
Created Apr 7 2008 - 17:17
User-Agent: jed (x86_64-pc-linux-glibc-debian)

Value of syntax highlighting for programming in text editors is hard to
overestimate. I recall one my buddy, a keen school olympic competitor on
programming, who said, that move from Borland Pascal 5 to 6 and 7 was a
great thing because of highlighting.

Many syntax and logic errors just popped up right before one's eyes.
Monotony strains. OTOH, Reading the book isn't like programming.
Programming requires great thinking efforts and no distractions. Those
LISP coders also track those parenthesis and think this is a cool thing.

So, i didn't see something quite comprehensive even in the great Emacs.
Unreadable regexs, reinventing parsing, small efficiency wrt CPU
burning. Not saying about *no* highlighting of regexs themselves, non
stupid highlight of `sh` scripts, `sed`, etc.

Maybe in 70x, where all "modern UNIX/Linux userspace software" stuck,
there was no computation and brain power, money and programmer's
imagination to implement that in a rational way.

The Right Thing(R) IMHO is to have any parser `sh`, `sed`, `awk`, `gcc`
etc. (yea, stupid XML!) implementing interface for highlighting of the
input. Isn't that those parsers know and do all their syntax handling?
Inventing unreadable regex's/broken highlight engines (emacs, mcedit,
etc.) over and over again?

Yet more than a decade x86 clones in terminal emulators are waiting
infinite microseconds between user's key presses...
--
sed 'sed && sh + olecom = love' << ''
-o--=O`C
 #oo'L O
<___=E M

Source URL:
http://kerneltrap.org/node/15933