Programming language design and implementation

Last updated

Programming languages are typically created 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 a lower level from, such as object code. [2]

Contents

Design

In programming language design, there are a wide variety of factors to consider. Some factors may be mutually exclusive (e.g. security versus speed). It may be necessary to consider whether a programming language will perform better interpreted, or compiled, if a language should be dynamically or statically typed, if inheritance will be in, 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]

Various experts have suggested useful design principles:

Implementation

Interpreters

An interpreter is a program that reads another program, typically as text, [4] as seen in languages like Python. [2] Interpreters read code, and produce the result directly. [8] Interpreters typically read code line by line, and parse it to convert and execute the code as operations and actions. [9]

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. [9]

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, which includes common concepts:

References

  1. Tomassetti, Federico (8 May 2019). "How would I go about creating a programming language?". Strumenta. Retrieved 3 March 2023.
  2. 1 2 3 "Compiler vs Interpreter". Geeks For Geeks. 17 January 2022. Retrieved 3 March 2023.
  3. "Programming Languages and Learning". Washington EDU. University of Washington. Retrieved 2 March 2023.
  4. 1 2 3 4 "How are Programming Languages created". GoNoCode. 8 December 2021. Retrieved 2 March 2023.
  5. Hoare, C. A. R. (1972). "The Quality of Software". Software: Practice and Experience. 2 (2): 103–105. doi: 10.1002/spe.4380020202 . S2CID   62662609.
  6. "Hints on Programming Language Design" (PDF). 1973. Retrieved 7 March 2023.
  7. "On the design of programming languages" (PDF). 1974. Retrieved 9 March 2023.
  8. Diver, Laurence (7 December 2021). "Published on Dec 07, 2021 Interpreting the Rule(s) of Code: Performance, Performativity, and Production". MIT Computational Law Report.
  9. 1 2 Rathi, Mukul (31 March 2017). "How I wrote my own "proper" programming language". mukulrathi. Retrieved 2 March 2023.
  10. Chouchanian, Vic. "Programming Languages". California State University Northridge. Retrieved 2 March 2023.
  11. Stroustrup, Bjarne. "A History of C ++ : 1979− 1991" (PDF). Archived (PDF) from the original on 2 February 2019. Retrieved 18 July 2013.
  12. Ferguson, Andrew. "A History of Computer Programming Languages". Brown University. Retrieved 2 March 2023.
  13. 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.
  14. "Installing GCC: Building". GNU Project - Free Software Foundation (FSF).