Answer the question
In order to leave comments, you need to log in
How to write your own scripting language?
Recommend good articles on writing your programming language.
Answer the question
In order to leave comments, you need to log in
There will be few articles for this task. Here you need at least SICP , and even better the book of the dragon .
I wrote my language by reading the dragon book and then using ANTLR
As an illustrative example, you can look at esprima , a js parser. It's well documented.
Take Lua .
Perhaps this is the simplest scripting language, and even embeddable, that is, you can simply take its ready-made implementation and embed it in your application. It will take a programmer about 15 minutes to learn the syntax. At the same time, it is a fairly powerful language that has almost everything you might need in terms of syntax. There are not many built-in functions, but the main ones are there, because the emphasis is on ease of learning (for your own users). And if you really need your own scripting language, then using Lua as an example, you can understand what the required minimum should be in the language, you can study the source codes, etc.
the skeleton is written in a day, we use the xml or json syntax so as not to write our own parser, we collect command objects, we write an interpreter that can respond to them - that's it, the simplest scripting language is ready,
branching according to the label-goto principle and saving command results in global variables (also most - label-value pairs)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question