Programming language design and implementation
This article, Programming language design and implementation, has recently been created via the Articles for creation process. Please check to see if the reviewer has accidentally left this template after accepting the draft and take appropriate action as necessary.
Reviewer tools: Inform author |
This article, Programming language design and implementation, has recently been created via the Articles for creation process. Please check to see if the reviewer has accidentally left this template after accepting the draft and take appropriate action as necessary.
Reviewer tools: Inform author |
In computer science, Creation of a Programming Language is typically done by creating an implementation called either an interpreter or compiler. Interpreters are designed to read programs, usually in some variation of a text format, and preforms actions based on what it reads.[1]
Design
In programming language design, there are a wide variety of factors to consider. It may be necessary to consider whether your programming language will perform better interpreted, or compiled, if your language should be dynamically or statically typed, how, or if inheritance will be in your language, and the general syntax of the language.[2]
Dynamic and Static Typing
Dynamically, and statically typed languages refers to how types are declared or checked.[3] Dynamically typed languages preform type checking at runtime, and types may be interchangeable, whereas statically typed languages must have variables declared before the program is run.[4] Statically typed languages come with the advantage of consistency, where variables may only be of the type they were assigned, which leads to better optimization and improved runtime performance, where Dynamic typing has the advantage of simplicity, which makes languages easier to pick up for beginners.[5]
Inheritance
Inheritance plays a big role in Object-Oriented Programming (OOP). Inheritance is the concept of one class deriving from another.[6] For example, if Class B derives from class A, it contains all of class A's members, including fields, and methods, with the ability to override methods, while still being able to implement unique members. Many Object-Oriented Programming languages, such as C++, implement variations of inheritance.[7] Languages may also implement multiple inheritance. A language supports multiple inheritance if it can derive of multiple base classes. In our example, class B might now derive of A, and C, containing both classes members, and having the ability to utilize them both.[7]
Implementation
Interpreters
An interpreter is a program that reads a program, typically as text, [8] as seen in languages like Python. Interpreters read code, and produces the result directly.[9] Interpreters typically read code line by line, and parses it to convert and execute the code as operations and actions.[10]
Compilers
Compilers are programs that read programs, also usually as some form of text, and converts the code into lower level machine code or operations[8]. Compiled languages converted to machine code, tend to be a lot faster, as lower level operations are easier to run, and outcomes can be predicted and compiled ahead of time. [10]
Process
Processes of making a programming language may differ from developer to developer, however, here is a general process.
- Design: Consider design aspects such as types, syntax, semantics, and library usage to develop your language.[11]
- Consideration: Consider how a language will be written. Languages like Python interpret code at runtime, whereas language like C++ follow an approach of basing it's compiler off of C (programming language)'s compiler.[12]
- Create an implementation: Write an interpreter or compiler. Compilers will convert to other formats, usually ending up as low-level as assembly, even down to binary.[13]
- Improve your implementation: Implementations should be improved upon. Expand your programming language, try to aim to have enough functionality to bootstrap, where a programming language is capable of writing an implementation of itself.
- Bootstrapping: If using a compiler, you may use the process of bootstrapping, where you rewrite the programming language in itself.[14] This is good for bug checking, and proving its capability.[15] Bootstrapping also comes with the benefit of only needing to program the language in itself from there-on.
References
- ^ Friedman, Daniel. "Essentials of Programming Languages" (PDF). Retrieved 2 March 2023.
- ^ "Programming Languages and Learning". Washington EDU. University of Washington. Retrieved 2 March 2023.
- ^ "Dynamic typing vs. static typing". University of Washington. Retrieved 2 March 2023.
- ^ "Dynamic typing vs. static typing". Oracle Docs. Oracle. Retrieved 2 March 2023.
- ^ Ortin, Francisco (1 December 2009). "Including both Static and Dynamic Typing in the same Programming Language". researchgate. Retrieved 2 March 2023.
- ^ Zeil, Steven. "Inheritance: The is-a relation". Old Dominion University. Retrieved 2 March 2023.
- ^ a b Thirunarayan, Krishnaprasad. "Inheritance in Programming Languages". Wright State University. Retrieved 2 March 2023.
- ^ a b "How are Programming Languages created". GoNoCode. GoNoCode. 8 December 2021. Retrieved 2 March 2023.
- ^ Diver, Laurence. "Published on Dec 07, 2021 Interpreting the Rule(s) of Code: Performance, Performativity, and Production". MIT. MIT.
- ^ a b Rathi, Mukul. "How I wrote my own "proper" programming language". mukulrathi. Retrieved 2 March 2023.
- ^ Chouchanian, Vic. "Programming Languages". California State University Northridge. Retrieved 2 March 2023.
- ^ Stroustrup, Bjarne. "A History of C ++ : 1979− 1991" (PDF). Archived (PDF) from the original on 2 February 2019. Retrieved 18 July 2013.
- ^ Ferguson, Andrew. "A History of Computer Programming Languages". Brown University. Retrieved 2 March 2023.
- ^ Glück, Robert (2012). "Bootstrapping compiler generators from partial evaluators". In Clarke, Edmund; Virbitskaite, Irina; Voronkov, Andrei (eds.). Perspectives of Systems Informatics: 8th International Andrei Ershov Memorial Conference, PSI 2011, Novosibirsk, Russia, June 27 – July 1, 2011, Revised Selected Papers. Lecture Notes in Computer Science. Vol. 7162. Springer. pp. 125–141. doi:10.1007/978-3-642-29709-0_13.
Getting started presents the chicken-and-egg problem familiar from compiler construction: one needs a compiler to bootstrap a compiler, and bootstrapping compiler generators is no exception.
- ^ "Installing GCC: Building". GNU Project - Free Software Foundation (FSF).