[comp.lang.smalltalk] Smalltalk scanner

bp@cs.hull.ac.uk (Barry Prescott) (05/25/91)

I have to produce a lexical analyser in Smalltalk-80 for an abstract
document editor. I thought I could reuse the Smalltalk class
'Scanner', but it looks like its tuned for scanning Smalltalk. 

 Is it worth my while useing this code, or should I start from
scratch?  Has anyone else done this?

I am using ParcPlace smalltalk v2.2

Thanks in advance,
--
Barry Prescott, Hypertext/CASE Systems Group, University of Hull, Hull, UK
INTERNET: bp@cs.hull.ac.uk		   Telephone: +44 482 465016	[]
JANET:    bp@uk.ac.hull.cs		   Fax: +44 482 466666		/
UUCP:	  ..!ukc!hu-cs!bp					[]<-----

sdl@d74sun.lyra.mitre.org (Steven D. Litvinchouk) (05/26/91)

In article <22808.9105242206@olympus.cs.hull.ac.uk> bp@cs.hull.ac.uk (Barry Prescott) writes:

> I have to produce a lexical analyser in Smalltalk-80 for an abstract
> document editor. I thought I could reuse the Smalltalk class
> 'Scanner', but it looks like its tuned for scanning Smalltalk. 
> 
>  Is it worth my while useing this code, or should I start from
> scratch?  Has anyone else done this?

I once had to write a scanner for an ASCII representation of "DIANA"
(an intermediate notation employed by Ada compilers and other Ada
tools).  I defined DIANAScanner as a subclass of Scanner.  I only had
to override four or five methods, including one to fix up the typeTable.
So for me it was worth it to reuse Scanner, because I was able to reuse
the same overall OO architecture of the class.

However, it was also apparent to me that some of Scanner's existing
methods were fairly long (by Smalltalk standards), and so my overrides
of those methods were also fairly long.  (I basically had to copy all
the code and make small mods to it.)


--
Steven Litvintchouk
MITRE Corporation
Burlington Road
Bedford, MA  01730
(617)271-7753
ARPA:  sdl@mbunix.mitre.org
UUCP:  ...{att,decvax,genrad,necntc,ll-xn,philabs,utzoo}!linus!sdl
	"Where does he get those wonderful toys?"