Programming language design and implementation
In computer science, Creation of a Programming Language is typically done by designing a form of representation of a computer program, and writing an implementation for the developed concept, [1] usually an interpreter or compiler. Interpreters are designed to read programs, usually in some variation of a text format, and perform actions based on what it reads, whereas compilers convert code to lower level.[2]
Design
In programming language design, there are a wide variety of factors to consider. It may be necessary to consider whether aprogramming language will perform better interpreted, or compiled, if a language should be dynamically or statically typed, if inheritance will be in a language, and the general syntax of the language.[3] Many factors involved with the design of a language can be decided on by the goals behind the language. It's important to consider the target audience of a language, its unique features and its purpose.[4] It is good practice to look at what existing languages lack, or make difficult, to make sure a language serves a purpose. [4]
Implementation
Interpreters
An interpreter is a program that reads a program, typically as text, [4] as seen in languages like Python [2]. Interpreters read code, and produces the result directly.[5] Interpreters typically read code line by line, and parses it to convert and execute the code as operations and actions.[6]
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[4]. Compiled formats generated by compilers store the lower level actions as a file. [2] 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. [6]
Process
Processes of making a programming language may differ from developer to developer, however, here is a general process of how one might create a programming language, that includes common concepts.
- Design: Design aspects are considered, such as types, syntax, semantics, and library usage to develop a language.[7]
- Consideration: Syntax, implementation, and other factors are considered. 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.[8]
- Create an implementation: A first implementation is written. Compilers will convert to other formats, usually ending up as low-level as assembly, even down to binary.[9]
- Improve your implementation: Implementations should be improved upon. Expand the programming language, aiming for it to have enough functionality to bootstrap, where a programming language is capable of writing an implementation of itself.
- Bootstrapping: If using a compiler, a developer may use the process of bootstrapping, where a programming language is rewritten in itself.[10] This is good for bug checking, and proving its capability.[11] Bootstrapping also comes with the benefit of only needing to program the language in itself from there-on.
References
- ^ Tomassetti, Federico. "How would I go about creating a programming language?". Strumenta. Strumenta. Retrieved 3 March 2023.
- ^ a b c "Compiler vs Interpreter". Geeks For Geeks. Geeks For Geeks. 17 January 2022. Retrieved 3 March 2023.
- ^ "Programming Languages and Learning". Washington EDU. University of Washington. Retrieved 2 March 2023.
- ^ a b c d "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).