|
From: | Hans Aberg |
Subject: | RE: Help with Flex input matching |
Date: | Thu, 7 Apr 2005 13:41:57 +0200 |
At 09:35 +0200 2005/04/07, address@hidden wrote:
> Flex matches patterns only at the beginning of the input.Only xu matches at the beginning. The v and the a are added by the default rule (when xu is removed), which matches any character and copies it to the output.Thanks for the help Vincent. Is the flex documentation a little misleading, or I have missed something? I mean I haven't read anywhere this simple rule, and according to the docs, I would say that what I had understood is reasonable, isn't it?
It is sort of folklore that parsers and lexers only match at the beginning of text, what they can match. From the formal point of view, Knuth coined terminology such as LL and LR, where the first letter L, indicates that parsing takes place from left to right. (The "L" should really have been "F" for forward, covering text written from right to left.) One can think of other methods to parse text, that such for matches in its whole; this is probably how humans do it. You might check in the newsgroup comp.compile and its FAQ, published there monthly. to get inputs on such more advanced topics.
-- Hans Aberg
[Prev in Thread] | Current Thread | [Next in Thread] |