Python 3 regex?

alister alister.nospam.ware at ntlworld.com
Tue Jan 13 08:23:24 EST 2015


On Tue, 13 Jan 2015 04:36:38 +0000, Steven D'Aprano wrote:

> On Mon, 12 Jan 2015 19:48:18 +0000, Ian wrote:
> 
>> My recommendation would be to write a recursive decent parser for your
>> files.
>> 
>> That way will be easier to write,
> 
> I know that writing parsers is a solved problem in computer science, and
> that doing so is allegedly one of the more trivial things computer
> scientists are supposed to be able to do, but the learning curve to
> write parsers is if anything even higher than the learning curve to
> write a regex.
> 
> I wish that Python made it as easy to use EBNF to write a parser as it
> makes to use a regex :-(
> 
> http://en.wikipedia.org/wiki/Extended_Backus–Naur_Form



I would not say that writing parsers is a solved problem.
there may be solutions for a number of specific cases but many cases 
still cause difficulty, as an example I do not think there is a 100% 
complete parser for English (even native English speakers don't always 
get it)

-- 
Keep the number of passes in a compiler to a minimum.
		-- D. Gries



More information about the Python-list mailing list