Smacc how to test scanner

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Smacc how to test scanner

Stephane Ducasse-3
Hi 

When writing grammar I would like to test the scanner. 
And I would like to this without having to define a special rule (in addition to the one of the language). Is it possible to get access to the scanner and ask it to scan the stream?

Stef
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Smacc how to test scanner

Thierry Goubier
Hi Stef,

I think it is possible. After compiling your parser and scanner classes, take your scanner class and create it on a stream

    stefScanner := StefScanner on: (ReadStream on: 'My test string for my parser').

Then each token will be retrieved with SmaCCScanner>>#next

    stefScanner next

Regards,

Thierry

2017-04-04 15:01 GMT+02:00 Stephane Ducasse <[hidden email]>:
Hi 

When writing grammar I would like to test the scanner. 
And I would like to this without having to define a special rule (in addition to the one of the language). Is it possible to get access to the scanner and ask it to scan the stream?

Stef

Loading...