Subject: Must See Health Announcement

From: Today on DocOz <[email-masked]>
Date: Thu, 21 Aug 2014 10:44:00 -0700

Having Trouble Viewing Images? Click Here

Today on DocOz

August 21, 2014

The Biggest Health Lie You Have Been Told (Revealed)

Biggest Misconception: You have to diet/exercise to Drop LBS

The Truth: You can melt fat without lifting a finger

<< PREV | TODAY | NEXT >> |

( to modify your message status with AYO Group )

write 1 2 0 0 WILSON ROAD Pittsburgh, PA 15236 or go here

The OP is asking to parse a very limited subset of XHTML: start tags. What makes (X)HTML a CFG is its potential to have elements between the start and end tags of other elements (as in a grammar rule A -> s A e). (X)HTML does not have this property within a start tag: a start tag cannot contain other start tags. The subset that the OP is trying to parse is not a CFG. regular languages are a strict subset of context- languages, but regular expression implementations in mainstream programming languages are more powerful. As noulakaz.net/weblog/2007/03/18/ describes, so-called "regular expressions" can check for prime numbers in unary, which is certainly something that a regular expression from CS theory can't accomplish. that may be strictly true, but only if you can depend on well-formedness. To be able to reliably parse even start tags one would have to accommodate a number of workarounds for (X)HTML syntax errors implemented in real world use
r agents, and even then probably cross fingers and pray. the same "only if" applies to all CFGs, does it not? I.e. if the (X)HTML input is not well-formed, not even a full-blown XML parser will work reliably. Maybe if you give examples of the "(X)HTML syntax errors implemented in real world user agents" you're referring to, I'll understand what you're getting at is exactly right. Most extant regex engines are more powerful than Chomsky Type 3 grammars (eg non-greedy matching, backrefs). Some regex engines (such as Perl's) are Turing complete. It's true that even those are poor tools for parsing HTML, but this oft-cited argument is not the reason whmost "full and short" answer here. It leads people to learn basics of formal grammars and languages and hopefully some maths so they will not wast time on hopeless things like solving NP-taskt another point of view hereare correct, I just want to drop this: You can write a finite state-machine that is equival
ent to any regex expression (finite state-machines are equivalent in power to Type 3 languages.) But to parse HTML you need memory, there is this thing called pushdown automaton that is basically an state-machine with a stack to store values. That can be used to parse HTML, unfortunately it is pretty hard to describe a pushdown automaton in text language (like you can represent state-machines in regex,) it is easier to program it yourse