Compilers, Interpreted Languages and Hybrid Implementation Systems
Welcome to the Crash Course on Artificial Languages!
Because the limit of your language is the limit of your world, you should know the language possibilites and how build cool stuff. Here, you’ll read the essential artificial language tools such as Compilers, Interpreted languages and Hybrid languages and how you can implement them yourself.
But, although writing another C-like big language is fun, it’s not a good idea. Humanity needs more domain-specific languages, something like MermaidJS, PlantUML, or Graphiviz. Consider the old adagio “Horses for courses”, so, please, build an useful language and share it.
The first idea you should consider is a language can be implemented of whatever kind, but typically an implementation is more common. For example, there are C interpreters and compilers, but in C case, the latter dominates.
Ch: A C/C++ Interpreter for Script Computing. (2022, December 02). Retrieved from https://drdobbs.com/cpp/ch-a-cc-interpreter-for-script-computing/184402054
Cling. Retrieved from https://root.cern/cling/
If you want to know more
Check out more tecnical stuff on https://carlos-eduardo-sanchez-torres.sanchezcarlosjr.com/Language-Processing-21343be7940e4ae79d7b7477fb8501ea.
Pure Interpretation
A piece of software (interpreter) translates (i.e. interpret) to an intermediary abstract code and provides a virtual machine on a real one. The interpreter usually is created as a different language and executes steps while running on a real machine. Mostly pure interpreted languages are 10 to 100 times slower in execution[1] than in compiled languages by code must be decoded line-to-line, however, this implementation tends to be flexible, offer dynamic typing and the code itself is platform-independent. Some popular interpreted languages are scripting languages, such as JavaScript, PHP, Python, Bash, etc. Sometimes they are called dynamic languages.
Case study
Lisp
LISP derives from ”LISt processor” [4], whose M.I.T. group’s goal was to create a language thought for Artificial Intelligence with his Symbolic Computation and independent of all electronic devices, meaning the first interpreted language in 1968 [5]. Although the first dialect ”LISP 1” runs on IBM 704. The LISP dialects can be written in several languages, such that C++, C o Assembly.
The paper that analyzes the dialect Common LISP, which was published in 1994 by ANSI [6]. Common LISP is a general-purpose language. It supports functional and object-oriented programming paradigms. LISP is commonly
interpreted by the LIST interpreter which reads code (LISP expressions), maintains data structures, and evaluates them, and shows out the results [7]. It can maintain data structures thanks to the atom table and number table where these lists are recursive.
Hybrid Implementation Systems
As purely interpreted language are slower than compiled languages by the type checker and syntactic analyzer, a brings up solution it’s the development of Just-In-Time (JIT) compilation and an intermediate language, where the gap is shirking.
Case study
Java
Java, whose goal is to write once, run anywhere [3], then Java interprets to come platform-independent (i.e. portability). Thus, his applications compile to bytecode, also called portable code or p-code, that can be run on Java Virtual Machine, which translates to the Java bytecode into the host machine. So bytecode is an intermediate representation.
Summary
References
[1] Tucker, A. B., &; Noonan, R. (2007). Programming languages: Principles and paradigms. In Programming languages: Principles and paradigms. New York: McGraw-Hill Higher Education.
[2] Sebesta, R. W. (2016). Concepts of programming languages. In Concepts of programming languages. Upper Saddle River: Pearson.
[3] ”Write once, run anywhere?”. Computer Weekly. May 2, 2002. Retrieved July 27, 2009.
[4] Jones, Robin; Maynard, Clive; Stewart, Ian (December 6, 2012). The Art of Lisp Programming. Springer Science & Business Media. p. 2. ISBN 9781447117193.
[5] John McCarthy. ”Recursive Functions of Symbolic Expressions and Their Computation by Machine, Part I”. Archived from the original on 2013–10–04. Retrieved 2006–10–13.
[6] 2021. ANSI INCITS 226–1994 (R1999) — Information Technology — Programming Language Common Lisp (formerly ANSI X3.226–1994 (R1999)). Ansi.org. Retrieved March 10, 2021 from https://webstore.ansi.org/standards/incits/ansiincits2261994r1999
[7] Gary Knott. 2008. Interpreting LISP. Retrieved March 10, 2021 from http://www.civilized.com/files/lispbook.pdf
[8] MIT, Harold Abelson, Gerald Jay Sussman, Julie Sussman. 2019. Lecture 1A: Overview and Introduction to Lisp. Retrieved March 10, 2021 from https://www.youtube.com/watch?v=-J_xL4IGhJA