From: brucedickey Date: 2001-08-01T03:44:46+09:00 Subject: [ruby-talk:18907] Re: Digits in method names > -----Original Message----- > From: Ned Konz [mailto:ned@bike-nomad.com] > Sent: Tuesday, July 31, 2001 12:22 PM > To: ruby-talk@ruby-lang.org > Subject: [ruby-talk:18905] Re: Digits in method names > > > On Tuesday 31 July 2001 10:24 am, brucedickey wrote: > > > Most mainstream > > parsers are limited to one character of look-ahead (if any) > (are LALR, > > LL(1), etc), and that is the reason for the restriction. > > My impression is that typical parsers have one _token_ of > lookahead, and that > typically a lexer would be responsible for assembling > _characters_ into > _tokens_. And it's pretty simple to determine where tokens end. Yes, and the lexer (speaking of a separate lexer and parser) has one character of lookahead which leads to the restriction on identifiers starting with digits. I had lumped the lexer and parser together and called it a "parser" -- I see that wasn't very clear. I'm used to tools that use a single grammar file for both. > The ambiguity I'd see would be with the representation of > floating point > numbers: what is "3e5" ? A lexer with K characters of lookahead, where K is rather large would gobble characters until a non-identifier/number character is encountered. A semantic function could then determine whether the accumulated buffer holds a string meeting the requirements of a floating point number. > -- > Ned Konz > currently: Stanwood, WA > email: ned@bike-nomad.com > homepage: http://bike-nomad.com >