Fundamentals of OOP
I recently developed some thought around programming languages
I'm writing a second article in the thought of understanding the depths of what it takes for a person to write their own Computer Language from scratch. It's important to understand the viewpoint as a Software Engineering because in the fundamentals of any language no matter how complex the programs get, the study is continuously there (in theory) for the software developer, hence the awareness of Ingenuity to the use of what the Programming Language is Designed and being used for.
To avoid anything too complex I found it wise to keep the approach to designing a language traditional. Using Python as the chosen language and using OOP as a fundamental role to programming, I used the goal of the project to simply focus more on the theory behind OOP and identifying common ground to any language and the basic functionality.
What this means is there are two types of languages in Computer Science, the first being that of a lower language which would require a developed compiler for the language to perform the task of building a program from the language which would in turn compile a program from the source code, translating the scripts into byte code so the computer understands how to execute and read the machine code as the software (executable file) runs consistently as it is being used. While the other option to creating a language is having the approach to develop an interpreter for the language (examples: python || bash), understanding the Semantics of the language to execute the process desired by the programmer creating and or using the language to create new software.
In my studies there are a few things that should be recognized with how the language actually works, and even though this is on a basic level it is universally applicable to all OOP languages. Here are some highlights.
Lexical Analysis
(ChatGPT Definition):
"A Lexer, also known as a lexical analyzer, is a critical component of a compiler or interpreter. Its purpose is to break down the input source code into individual tokens, which are the smallest meaningful units in the programming language."
The interesting thought behind this statement is that the Lexer is on both sides of the coin given the language type. The reason for this is in functionality of a programming language. Where the Lexer reads or scans for the tokens in the entire source code written by the developer. Given the design of the language, there are a few things to think about in the approach of understanding a language.
The Nature of a Token.
"... Tokens are the building blocks of a program, and they represent the fundamental elements of the language's syntax. The process of breaking down the source code into tokens is called lexical analysis or tokenization".
It is interesting
The Characteristics of a Programming Language
Paradigms: Programming languages often adhere to specific programming paradigms or styles, such as procedural, object-oriented, functional, or logic-based programming. Each paradigm offers a different way of organizing and structuring code. (ChatGPT)
I gathered these characteristics in light of research with the question "What is a programming language??" and have used the guidelines of ChatGPT for the best understanding of the subject.
1) There is first the structure of the language, just like any language there is grammar and the syntax in which it is written and organized. The fundamentals of programming and how the language is expressed through a set of rules in how the programmer is asked to write the code to the program. In essence the syntax (like grammar) defines expressions such as loops, variables, conditions, and functions.
2) Given the syntactical groups, this would be within the realm of semantics where the accuracy of the intended process and operation of the expressions written syntactically are efficient given data manipulation in the execution of the written program and how it is intended to operate.
3) "...Programming languages provide varying levels of abstraction, allowing developers to work at higher or lower levels of detail. High-level languages offer more abstraction, simplifying complex tasks, while low-level languages give more direct control over hardware" (ChatGPT).
4) The overall goal of programming is to have the execution of the desired result. In C programming and other low-level languages like Rust, the result of the compiled software is the executable file that runs on machine code. During the execution process of the code there are different features to functions given libraries and how the functions are called on while being processed or Compiled.
"Decide on the language's syntax, semantics, and features. Will it be imperative, declarative, object-oriented, functional, or a combination of these paradigms?
Identify the target audience and their needs. Consider factors like ease of use, performance, and safety"(ChatGPT).
In the execution process, the given language types and design and their differences in Run-Times of the executed program has my curiosity. Here is an explanation of what I'm trying to express.
"...Programs written in a programming language need to be translated or compiled into machine code, which the computer's CPU can understand and execute. This translation can happen either before runtime (compiled languages) or during runtime (interpreted languages)" (ChatGPT).
I have a medium post on the aspect of writing or developing library functions in C for custom prototypes to the design of a program here
Why Develop A Computer Language?
When I think about a computer language, what I think about is what's happening under the hood?? What part of the computer is being processed? what type of data is being managed by the language, is it graphical, or simply logistic and analytical like that of a C program. There's a lot of questions but over all I think the solution is solving a practical real world problem between humans and software design.
An example would be a gaming engine, or even a web browser which has to process graphics as part of the user experience and interaction. In this case there would be a lot of use of JavaScript given the thought that there's the need to compile usable and reusable code for the sake of rendering, and processing procedures that are web-assembly based or another example would be Unity and the Universal Rendering Pipeline to develop software and apps on multiple platforms or devices.
Pillars to a Computer Language
In my own writing while going through writing a computer programming language, freecodecamps youtube video covered the four pillars that give a computer language functionality. Also, this is in reference to python being the base language as an OOP language.
领英推荐
1.Encapsulation ==> Lexer (data, Functions) || Parser (data, Functions) *** Grouping Data, and Grouping Functionality with Encapsulation!
2.Abstraction ==> lexer = Lexer().tokenize()
Calling the lexer object and having usability in the tasks being implemented. OOP Communicates the Input and Output. Abstraction makes code look simple.
3.Inheritance ==> page : Heading; Body; Image; Home; About (all of these would be inherited by the home object) Objects store DATA! inherit the data and use the class.
4. Polymorphism ==> dog(makedogsound), cat(makecatsound), birds(makebirdsound) (they all make a sound but each sound is different!)
polymorphism is a common interface which would be Animal(makesound). Many = poly.
To be Continued..
Thanks for reading!!
resources
Yacc (Yet Another Compiler-Compiler)
Interpreters || REPL
Lexer
Libraries
GoLang
Roslyn
Ruby on Rails
Ruby: Ruby is known for its clean and elegant syntax, making it suitable for building user-friendly command-line interfaces. The Option Parser and Thor libraries are often used for CLI development in Ruby.