Vasily Viktorovich (hereinafter simply Vasya) worked at the office for the third year. A programmer by training, he was in good standing with director Alexander Ivanovich, he did not doubt his professional skills at all and was ready to entrust him with any important task. The director often recruited new employees to help Vasya, but they all didn’t stay long — Vasya complained that the programmers who were bad with them didn’t want to work, they were writing code in which the devil himself broke his leg, besides he stuffed his OOP everywhere and patterns.
- Vasya, so maybe you will work yourself? Already ten people have been fired ... I understand, specialists in our time cannot be found, I understand that it is difficult for one to work, but you can still try, eh?
- Ivanovich, I would love to, but who then will be engaged in minor matters? I write the most important things, and it's always very difficult to be distracted by trifles. Find me a good man, Ivanovich! I believe that one day he will get the one who can work like me, or even better!
- What are you, Vasya, I have already made sure that I cannot find anyone better than you. I will try, Vasya, I will try!
The director patted him on the shoulder and left the office. And Vasya pressed Alt + Tab and continued reading the tape.
- Vasya, meet, this is Andrew. I graduated from university two years ago, worked for Yandex for seven months, I think the recommendations are good, you’ll work well, ”the director winked.
Vasya looked disapprovingly at the recruit, figured in his mind how many days he would fly out of here and, slyly smiling, stretched out his hand to the smiling boy.
- Vasily Viktorovich, - he grunted.
“Very nice,” the boy continued to smile, which only angered Vasya.
- Well, you familiarize Andrei with his duties, and I will go.
When the door slammed shut behind the director, Vasya pointed to a computer at a newcomer and threw him a couple of “simple tasks”, on which, frankly, he had been working for more than one month.
')
Andrei opened the project and was horrified: there was not a single comment in the code, there was simply no formatting, the names of the variables and methods did not correspond to reality. Andrei knew that this day would come. From university, he was preparing for the worst option, but he was not ready for what he saw - the boy's smile disappeared without a trace, and tears came to his eyes. “Hold on, Andrejka, hold on,” the boy urged himself day after day. For ten days of work in this terrible office, Andrew realized that Vasily Viktorovich was bylokloder. Of course, he had some knowledge, otherwise Alexander Ivanovich would immediately suspect the incompetence of this “specialist”, but otherwise he did not want to program normally.
Andrew realized that he would not last that long. He had one ability that nobody knew about - he was good at hypnosis. Then one day, after a hard day’s work, he approached Vasya, snapped his fingers and whispered a few phrases ...
Vasya woke up not immediately. At first there was some ominous deaf sound in my ears, then the blackness in my eyes gradually turned into muddy ripples, and then once - and it stands in some incomprehensible room. Around nothing, only the white floor and gray ceiling. No noise. It seemed that Vasya could hear his own heartbeat. From somewhere a click of the mouse was heard, and the silence began to acquire some intense shades, as if before a storm.
Build started.
- Hey you, hurry, you need to read these source code files here.
“HHH?” What fa ...
“Well, lively, I said,” he heard a lash, accompanied by Vasya’s scream. - You read these files, you enter all the information in the table of tokens. If something strange meets, press the brake valve with the appropriate error message. And TRY!
Vasya unrolled a long scroll with the name "main" and began to read it. An inconvenient formatting immediately caught my eye, the letters now and then merged into one, forming a mess, the variable names contained no more than three letters — it's hard to remember whether a variable was declared or not. The same story was with the names of the methods. It seemed to Vasya as if he was familiar with this code, but there was no time to think about it - he was so often beaten with rods that he could hardly read what was written normally.
Having finished with one file, Vasya sat down to rest and immediately received a series of new hits. Recognizing himself, he unfolded another scroll with the name “Krname” and began everything in a new way. Then there were the files "qwerty", "MegaUtils", "dList", etc. Vasya's eyes began to get tired, his back hurt from endless strikes with a whip and rods, his hands shook from constantly writing down the tokens on the table - Vasya went to hell.
After a very large amount of time, Vasya still managed to look through all the files and enter the information into the table of tokens. "Well, finally," he wiped the sweat from his brow.
- What fell apart? Take the tables of lexemes, check their syntactic correctness and build the parse tree using this data! If you miss something, you will redo everything again. For the work!
Vasya began to compare the data in the table with the Book of Rules and to draw a tree of operators and operands on a huge sheet of paper. Line by line, lexeme by lexeme, he checked records. Top by top, edge by edge, he drew a tree. In the eyes of the characters loomed, a lot of characters, they had no end. And then Vasya came across a line that was not specified in the rules. Without thinking twice, he pulled the lever labeled "Syntax error". The work stopped immediately, the lashes ended, the leaf in which the tree was painted cleared, an ominous silence came again. Vasya fell to the floor, exhausted. He did not have to rest for a long time, after only two minutes the work began ... again. Vasya shouted “No” in despair, but his back was burned with a pair of new hits, I had to read all the files in a new one.
Any fraction of eternity, in any case, it seemed to Vasya, he went through the scrolls with the source code and checked the lexemes table. Fortunately, there were no more syntax errors, but this did not alleviate Vasya's fate, there was a new test ahead.
“Hey, take the syntax tree and mark the correct typing,” the voice commanded, lashing the poor man.
Vasya's fatigue made itself felt, he continually stumbled when checking types, but the feeling that he would redo everything anew, if he made a mistake, added a bit of enthusiasm to his work.
- Now generate what you have in an intermediate language. And do not forget to optimize the received !!!
Vasya flinched - he had never done any optimizations before. He did not like to enter duplicate pieces of code in a separate method, he did not often use cycles, he even called the variables as short as possible, because he believed that all these little things distract from the main occupation - programming. Why think about optimization if the program itself is important? But no matter how critical Vasya's opinion was, a couple of lashes did their job - he began to optimize. He looked at individual lines of code and tried to find them the best option. He unwrapped loops, collected sequences of lines into a pair of shorter ones, rewrote some fragments.
Vasya's head buzzed. It seemed that the devil himself was punishing him for many years writing bad code. Having optimized the last remaining line, Vasya fell to his knees and squeezed out:
- I can not take it anymore.
- How can you not? And who will generate machine code? I, by the way, do it hundreds of times a day and do not complain. Every day I read your horrible code, study the types of your nonsensical variables, optimize all your incompetent creativity, so that you can get a program that does not even start because you forgot to prescribe the module call! I have to do it again and again until you bother to prescribe it. And I do not receive a single word of gratitude, on the contrary, I constantly hear “Compile you faster, infection!”, “What is this mistake? I have everything in the code correctly! ” I do not have the opportunity to say what I think about you, because I do not have leverage with the right phrases. But if they were, you would be afraid to press "Compile" ... And now get up and generate the machine code!
Vasya obeyed and began to replace the instructions of the intermediate language with the instructions of the machine code. My hands were barely raised, my eyes were dull, whistling was heard in my ears, my legs were weakened, my back was burnt with new blows, my neck barely kept the head boiling from the endless stream of information. Yes, Vasya went to hell bydlokodera. He knew that for sure. If he ever gets out of here, he stops writing bad code, starts formatting sources, gives meaningful names to variables and methods, starts optimizing his programs and never, ever again, scold the compiler!
Build successfull. Elapsed time: 00:01:19.
... Vasya opened his eyes. There was no one in the office. The development environment was opened on the monitor screen. On one of the unformatted lines the cursor was blinking. Vasya reached for the keyboard and held Ctrl + Backspace. The cursor ran, taking with it everything that was written in the last months of work. Leaving a clean source file, Vasya got up, looked at the compiler output console and said: “Thank you”.