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.

anders pearson


In reply to Re: Re: Re: Re: Re: Re: original definition vs final language by thraxil
in thread original definition vs final language by dystrophy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.