If your audience is smart you can also use an alternative way of demonstrating 
the value of grammars and parsing by taking a very simple parsing example (one 
that requires state management if implemented literally) and showing a slide 
before anything else that has a literal non-grammar based implementation - 
complete with "if ($state == 1) { stuff; }" etc type stuff. Usually balanced 
and nested parens is a good example as it's a common problem.

Most of your audience will think "this is crazy - why not use regex?" which is 
where you go to the next slide showing the regex implementation and the 
associated hairiness involved to get the job done. 

After they realize it's less trivial than they thought you show them the 
BNF/parser based approach and they then fully realize the value - rather than 
just assuming this is some kind of arcane 1960s approach to getting the job 
done. A lot of programmers today lack basic knowledge on things like grammars, 
FSMs, etc because they've been taught "regex is the hammer" along with too much 
high level language teaching at the expense of low level problem solving. In a 
sense, they're sheltered by the features of their tools but when said tools 
cannot do something efficiently they do not know where to go because they lack 
survival skills. You end up with a lot of really sketchy/brittle/inefficient 
"solutions."

This is why C should continue to be the first real language students are taught 
in and things like Java and the like are deferred until students adequately 
understand the value proposition of why they would use a higher level language 
vs a lower level one. Relative value requires contrast and jumping right into 
languages that provide "convenience factor" quickly ultimately dumbs people 
down by reducing critical thinking.

Also, man does not respect hammer until he smashes his thumb.

On Jun 19, 2014, at 3:09, Ruslan Shvedov <[email protected]> wrote:

> Finally, this quote from Jeffrey helped me understand BNF better; perhaps 
> it'll be useful to you.
> 
> So the basic idea of the SLIF is BNF -- a rewriting system with an alphabet 
> of terminals, and rules which are composed of symbols. In a context-free 
> grammar every rule has one LHS symbol, and zero or more RHS symbols. Add a 
> special start symbol, and you're ready to rock 'n roll!

-- 
You received this message because you are subscribed to the Google Groups 
"marpa parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to