On 4/16/07, Oleg Kobchenko <[EMAIL PROTECTED]> wrote:
However, will it distinguish between .... and .. ?

Not as written.  I would need to add a bunch more states
(weighing in at five characters each) to make that kind
of distinction.

Then again, we are talking about pattern matching here,
not lexical analysis.  Regular expressions are much more
concise than raw ;: parsers for this kind of pattern matching.

That said, I could use something like
  validDate=: (2+6{.2) [EMAIL PROTECTED]: #@>

Will it consume just the pair of triples or will
return whatever assortment of ' -:' separated numbers?
Which would be the same as simple ;: after
replacing ':-' with ' '.

I am not sure what you mean by "consume".

If you are asking whether my "split" routine would
ignore leading and trailing garbage -- no, it will not.
This is why I said:

. For example, the rxscan version can pull an iso date out
. of the middle of a line with other text in it, where my split
. verb would incorporate this other text in its result.

Once again, I will not disagree that regular expressions are
better in the role of regular expressions than the ;:
sequential machines are.

On the other hand, I do think ;: sequential machines are better
for lexical analysis than regular expressions are.

That said, given a significant investment you can write lexical
analyzers based on regular expressions and, given such a
system you can probably produce cases where the code
required to implement a lexical analyzer using raw ;: is greater
than the additional code required to build a lexical analyzer using
the system which includes regular expressions.

--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to