There's more than one way to do things | |
PerlMonks |
Re: Re: Re: Re: Re: Re: original definition vs final languageby thraxil (Prior) |
on Oct 25, 2002 at 17:46 UTC ( [id://208095]=note: print w/replies, xml ) | Need Help?? |
i think you're misunderstanding the meaning of the word 'context' in the term 'context-free grammar'. 'context' isn't the same as 'memory'. check out this wikipedia entry for a decent discussion of CFGs. i've had the idea of writing an article on formal language and automata theory aimed at perl programmers floating around in the back of my mind for a while. maybe i should get around to doing that soon. the short version as it relates to the topic at hand is this: a Finite Automata is a state machine with a finite number of states. it essentially has 'memory' equal to the number of states in its definition. a pushdown automata is a state machine that uses a stack to store its state so it can essentially have infinite 'memory'. however, because it can only push and pop the stack, it doesn't have a sense of 'context'; it can only see what's at the top of the stack. beyond pushdown automata there are turing machines which use a tape and can access it at any point, so they are able to have a sense of 'context'. languages are defined by the kind of automata that accept them: regular languages are accepted by finite automata, context-free languages are accepted by pushdown automata, context-sensitive languages are accepted by finite turing machines, and recursively enumerable languages are accepted by infinite turing machines. the mapping of languages to machines and how it all fits together is called the Chomsky Hierarchy. that was a gross simplification of the whole thing. hopefully i can make up for it with a full article in the near future.
In Section
Meditations
|
|