A guide for the Ignorant Programmers.
I have tried to explain the concepts using very basic level of English language, so that a lot of newcomers can understand it without getting an imposter syndrome attack 😂
A programming language is like a natural, human language in that it favors certain metaphors, images, and ways of thinking.
— Mindstorms: Children, Computers, and Powerful Ideas, Seymour Papert (1980)
We define programming, as a general human activity, to mean the act of extending or changing a system’s functionality. Programming is a widespread activity that is done both by non-specialists (e.g., consumers who change the settings of their alarm clock or cellular phone) and specialists (computer programmers, the audience for this article).
It is the most popular Programming language today.
But how many folks do actually understand this language?
Probably this the only language which is used(usually in scripts) before it is fully understood.
Yet we can’t deny this fact that overall it is a beautiful Programming language.
Have you Ever Wondered, how do those assortments of programming statements tell the Computer what to do?
Statements like a = a + 2 are helpful for developers when reading and writing, but are not actually in a form the computer can directly understand.
So an uncommon utility on the Computer (either a interpreter or a compiler) is utilized to decipher the code you compose into directions that a Computer can comprehend!
For some computer languages, this translation of commands is typically done from top to bottom, line by line, every time the program is run, which is usually called interpreting the code.
For other languages, the translation is done ahead of time, called compiling the code, so when the program runs later, what’s running is actually the already compiled computer instructions ready to go.
In this article we will LEARN about some essential concepts that will help you to understand what actually happens under the hood.
Concepts that we will learn here are :
- Syntax Parsers
- Execution Contexts
- Lexical Environments
GOAL : Understanding Syntax Parsers, Execution Contexts, and Lexical Environments in a Simple Language.
All three of these are complicated sounding terms that actually aren’t that difficult to understand.
A PROGRAM THAT READS YOUR CODE AND DETERMINES WHAT IT DOES AND IF IT’S GRAMMAR OR SYNTAX IS VALID
Was that too hard to comprehend?
Those programs are called compilers and at times they also have to do with interpreters, but those programs interpreters and compilers do the process the work of actually reading your code character by character and determining if the syntax is valid and then implementing that syntax in a way the computer can understand,
and a program that is going to convert what computer can understand !
If you have a function with the variable, then that function and variable will be represented in memory but it’s being translated from what you have written what is more human readable to what the computer can understand. There’s a compiler or an interpreter between those two things and part of that is a syntax parser so, it’s going through your code
character by character like f /u/ n/ c/ t/ i/ o/ n
and it says : Oh! that’s function 😃 ,So there should be a space after this ! and then the next thing I see up until the parenthesis ( ) will be the name of the function,
above Greet is next thing the computer sees up until the parenthesis ( ) so it assumes that Greet will be the name of the function.
And all this gets translated by the systems that someone else wrote but that also means that in that translation process ,the programmers who wrote the compiler can choose to do extra stuff .
The word lexical means having to do with words or grammar so we’re talking about the code you’re writing it’s syntax it’s vocabulary !
Now a lexical environment exists in programming languages in which,where you write something which is important.
It sounds kind of funny but actually not every programming language is that way, but remember we said you might have some code.
let’s say a function with a variable inside of it the variable sits lexically inside the function ,that is : physically the code that you’re writing
that’s where it sits but remember we said that your code is not what’s actually given directly to the computer but it’s translated into something the computer can understand
In programming languages where the lexical environment is important that means that where you see things written gives you an idea of where it will actually sit in the computer’s memory of how it will interact with other variables and functions and elements of the program and that’s because the program or the compiler that’s converting your code to those instructions cares about where you put things it makes decisions that syntax parts are going through everything makes decisions so when we talk about the lexical environment of something in the code we’re talking about where it’s written and what surrounds it got that.
To help manage the code that is running there are lots of lexical environments areas of the code that you’re looking at physically but which one is currently actually running is managed via what’s called
There are lots of lexical environments which one is currently running and managed via execution contexts.it contain things beyond what you have written in your code!
Execution context is whole topic by itself which we will deal in some other article.