DEV Community

Ez Pz Developement
Ez Pz Developement

Posted on

Compilers, Hand coded scanners

After discussing the basics of table and hand coded scanners, it is the time to write a post about the hand coded one, the two previous scanners are auto generated and use the DFA as the backbone for all the operations, but the hand coded scanners is totally different with a goal of reducing the cost of simulating the DFA, in order to achieve this a careful implementation is needed.

The author of Engineering a compiler mentioned that they did an official survey, the results was that this hand coded scanners was used in the most of opensource and commercial compilers.

This last mentioned scanner has some disadvantages, for example doing an i/o to read a character has significant impact in the performance, if we compare it to the DFA.

To solve this issue the compiler writers use a buffered i/o, where each read operation return a longer character, we keep track of the current position by using a pointer.

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay