www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Looking for resources on interpreter design

reply solidstate1991 <laszloszeremi outlook.com> writes:
I decided to make my college thesis on creating a BASIC 
interpreter in D for scripting, command line, and other purposes. 
However, I have an issue with finding resources, meaning that I 
couldn't work on it yet since I cannot cite anything.

Can anyone help me? It doesn't need to be for D since I 
understand many other programming languages (and I bet there's a 
massive lack of literature about D), but I do have budget 
restrictions, so I cannot buy expensive books. Also I would like 
to have something also on BASIC.
Jun 06
next sibling parent reply Max Haughton <maxhaton gmail.com> writes:
On Thursday, 6 June 2019 at 19:38:25 UTC, solidstate1991 wrote:
 I decided to make my college thesis on creating a BASIC 
 interpreter in D for scripting, command line, and other 
 purposes. However, I have an issue with finding resources, 
 meaning that I couldn't work on it yet since I cannot cite 
 anything.

 Can anyone help me? It doesn't need to be for D since I 
 understand many other programming languages (and I bet there's 
 a massive lack of literature about D), but I do have budget 
 restrictions, so I cannot buy expensive books. Also I would 
 like to have something also on BASIC.
If you want a book on D programming, Ali and Andrei's books are the goto resources. I would not interpret BASIC, but that's up to you. https://craftinginterpreters.com/ is good, and also any compiler textbook will be fine for building an AST.
Jun 06
parent Max Haughton <maxhaton gmail.com> writes:
On Thursday, 6 June 2019 at 22:27:14 UTC, Max Haughton wrote:
 On Thursday, 6 June 2019 at 19:38:25 UTC, solidstate1991 wrote:
 [...]
If you want a book on D programming, Ali and Andrei's books are the goto resources. I would not interpret BASIC, but that's up to you. https://craftinginterpreters.com/ is good, and also any compiler textbook will be fine for building an AST.
*parsing and building an AST
Jun 06
prev sibling next sibling parent =?UTF-8?B?UsOpbXkgTW91w6t6YQ==?= <remy.moueza gmail.com> writes:
On Thursday, 6 June 2019 at 19:38:25 UTC, solidstate1991 wrote:
 I decided to make my college thesis on creating a BASIC 
 interpreter in D for scripting, command line, and other 
 purposes. However, I have an issue with finding resources, 
 meaning that I couldn't work on it yet since I cannot cite 
 anything.

 Can anyone help me? It doesn't need to be for D since I 
 understand many other programming languages (and I bet there's 
 a massive lack of literature about D), but I do have budget 
 restrictions, so I cannot buy expensive books. Also I would 
 like to have something also on BASIC.
I have collected a few links I liked about interpreters. This tutorial explains how to build a lisp in Javascript. The author first uses a simple approach and then revisit in several passes to optimize or make some construct possible (like continuations and exceptions): http://lisperator.net/pltut/ This paper explains how to build an interpreter using closures. This is a trade-off between the simplicity of an AST based interpreter and performance close to "threaded" code (the program are made of successif call to native library functions): http://www.iro.umontreal.ca/~feeley/papers/FeeleyLapalmeCL87.pdf This article is a simple explanation of the fundamental principles of a bytecode interpreter / virtual machine: https://bernsteinbear.com/blog/bytecode-interpreters/ From the same author of https://craftinginterpreters.com/: - An article about inventing a precise garbage collector: http://journal.stuffwithstuff.com/2013/12/08/babys-first-garbage-collector/ - The Wren language. Its source code is highly readable, of a reasonable size and with good explanations on what's going on: https://github.com/wren-lang/wren This articles describe a CESK machine, in a mathematical way. There is a link to some working Racket code at the end. The bottom of the page contains links to subject related to programming language implementation methods: http://matt.might.net/articles/cesk-machines/ Half of those links are using a variant lisp, as its simplicity can help describe concepts in a concise form. The principles can then be applied in another programming language.
Jun 08
prev sibling parent reply Basile-z <b2.temp gmx.com> writes:
On Thursday, 6 June 2019 at 19:38:25 UTC, solidstate1991 wrote:
 I decided to make my college thesis on creating a BASIC 
 interpreter in D for scripting, command line, and other 
 purposes. However, I have an issue with finding resources, 
 meaning that I couldn't work on it yet since I cannot cite 
 anything.

 Can anyone help me? It doesn't need to be for D since I 
 understand many other programming languages (and I bet there's 
 a massive lack of literature about D), but I do have budget 
 restrictions, so I cannot buy expensive books. Also I would 
 like to have something also on BASIC.
Found in an AWESOME list : https://www.amazon.com/dp/1852339691 (https://github.com/aalhour/awesome-compilers#books), there are more in the book section, I see a few ones dedicated specifically to VMs
Jun 09
parent reply Yatheendra <3df4 gmail.ru> writes:
Is there any write-up or talk about the Javascript interpreter 
Walter Bright wrote? Was it written in  nogc D by any chance?
Jun 16
parent reply Basile B. <b2.temp gmx.com> writes:
On Sunday, 16 June 2019 at 20:28:49 UTC, Yatheendra wrote:
 Is there any write-up or talk about the Javascript interpreter 
 Walter Bright wrote?
There was this in 2013 : https://dconf.org/2013/talks/chevalier_boisvert.html, not Digital Mars ECMA but Higgs, a JS VM.
 Was it written in  nogc D by any chance?
nogc attribute didn't exist at that time.
Jun 16
parent Yatheendra <3df4 gmail.ru> writes:
On Sunday, 16 June 2019 at 20:37:21 UTC, Basile B. wrote:
 There was this in 2013 : 
 https://dconf.org/2013/talks/chevalier_boisvert.html, not 
 Digital Mars ECMA but Higgs, a JS VM.

 Was it written in  nogc D by any chance?
nogc attribute didn't exist at that time.
Thanks for the information.
Jun 16