DEV Community

TechThatConnect
TechThatConnect

Posted on

Parsing, what does a browser do with my code

After much time learning all the ins and outs of web development I came to the realization that I had little to no idea how a web browser actually functions. I knew that it would take my code to spit out a result. So I started to do some reading.

What is Parsing

So what is parsing anyways. You might hear the word but not know exactly what it means. Well you came to the right place. This word has meaning outside of computer science. In fact the meaning is almost the same in English. Merriem-Webster defines it as.

Parse - to divide (a sentence) into grammatical parts and identify the parts and their relations to each other.

We parse English text when editing a paper for example. Insert meta joke about me editing this article. In programming the definition is very similar. MDN defines it as.

Parse - to analyze and convert a program into an internal format that a runtime environment can actually run, for example the JavaScript engine inside browsers.

You can think of parsing like a sign language interpretation. Converting the show into a usable format for people without hearing.

Web browsers

The web browser isn't new technology but you might be surprised just how they work. First and foremost a browser is a piece of software. The purpose of a browser is to take in data from the web or other sources and then display the Information in a way we humans can understand. Now you would probably assume that we at this point have the way in which a browsers parse code to a global standard. However this is far from the truth. If you have spent much time writing css you have probably heard of browser prefixes. This is a prime example of how different browsers parse data.

How does this affect my code?

It might and it might not. Let's think about a parser like Google translate. Depending on what language you are translating from and to the end result may vary. This is much the same with parsing engines in modern browsers. Safari might render some html differently than Chrome will. These inconsistencies are the reason that front end devs worry about cross browser support. Why testing your site on as many browsers as possible before releasing it to the wild is a must.

A parser is just a part of a web browser. There are many other elements, a javascript runtime engine for example. Front end devs write a lot of code for web browsers. I feel understanding core concepts of how a browser works can only make you a better developer. This is only a broad overview and you can go a lot more in depth as to what a parser is and how they work under the hood but that is another article for another day. I hope this helped you in your journey to better understanding the web. Feel free to leave a comment in the database so my browser can parse it.

Top comments (0)