Can I Built a Programming Language From Scratch
Download Article
Download Article
Many people have difficulties or frustrations with the programming languages they use every twenty-four hours. Some want things to exist handled more abstractly, while others dislike implementing features they wish were 'standard'. Whether you are an IT professional or simply a hobbyist, many times you may find yourself wanting to create a new programming language.
Steps
-
1
Become familiar with the engineering. You can't create a programming language if you don't know how to use a computer.
-
2
Become familiar with the terminology. Compiler writers often apply unfamiliar terminology. Read up on compilers before proceeding. Be sure to know everything that you need to know.
Advertisement
-
iii
Decide what trouble your linguistic communication is solving. Is information technology addressing a domain-specific problem, or is it a general-purpose language?
-
iv
Retrieve nigh the semantics of your language and the concepts of it.
- Are you going to allow direct pointer access or not?
- What are the data types of your language?
- Is it a static or dynamic linguistic communication?
- What is your memory model? Are you lot going to use a garbage collector or manual memory management? (If you lot apply a garbage collector, prepare to write one or suit an existing 1 to your language.)
- How are going to handle concurrency? Are you going to use a simple threading/locking model or something more complex like Linda or the actor model? (Since nowadays computers have multiple cores.)
- Are at that place archaic functions embedded in the language or volition everything come from a library?
- What is the paradigm or paradigms of your language? Functional? Object-oriented? Image (like JavaScript)? Aspect-oriented? Template oriented? Or something entirely new?
- How is your linguistic communication going to interface with existing libraries and languages (mainly C)? This point is important if you're building a domain-specific language.
- Finally, some of the answers to these questions are going to be answered past the second step and volition help yous respond the side by side step.
-
5
Call up of some specific tasks that someone would want to exist able to perform with your language. For example, 'they may want to straight a robot to follow a line' or 'they may want to create relatively portable desktop programs in it' or 'they may desire to create web applications with it'.
-
6
Experiment with syntax ideas (the text of the language) for the above examples.
- Exist careful to keep your language in the context-free linguistic communication category or something inside information technology. Your parser generator and you will appreciate it subsequently on.
-
vii
Write out a formal grammar for the syntax.
-
eight
Make up one's mind whether the linguistic communication will be interpreted or compiled. Meaning that in the interpreted world your user will typically edit your programme in an editor, and run it directly on the interpreter; while in the compiled globe, your user will edit your program, compile information technology, save the resulting executable somewhere and run it.
-
9
Write the front end scanner and parser or detect a tool that helps you lot with this.
- Also, call back about how your compiler/interpreter will warn your user virtually erroneous programs and syntax errors.
-
10
Use the parser data to write the object code or an intermediate representation. Accept the parser create an AST, then create your object lawmaking from the AST using three accost code or its big brother SSA, then create a symbol table to define your functions, global variables, etc.
- Also, depending on your language, you may also want to create virtual pointer tables or information tables for your classes (in gild to support reflection or RTTI).
-
11
Write the executor or code generator that volition bind everything together.
-
12
Write many test programs to test the language.
- Y'all want to create programs that stress the burdens of your formal grammar in order to see that your compiler accepts everything that is inside your definition and rejects everything that is exterior of it.
-
xiii
Consider how the user will debug their own programs.
-
14
If your language uses a standard library, you will want to write it. Along with a garbage collector or other runtime features if yous need it.
- Specifically, if yous write a compiler, y'all will need the code that the operating system will execute in guild to begin running the user code (for case, allocating all global variables).
-
15
Publish your linguistic communication, along with the specification for it and some examples of what you can practice in it.
- Don't forget to document how yous can integrate with existing libraries, languages and how to employ the runtime features and/or standard library.
Advertizement
Add together New Question
-
Question
What are pinnacle 5 best programming languages?
Living Concrete
Meridian Answerer
There is no "best" programming language. Each programming language has its strengths and weaknesses. Information technology'due south upwardly to the programmer to decide whether or not a programming language suits his or her project based on those strengths and weaknesses.
-
Question
How do I publish a programing language?
You should create a website, which, if you are familliar with coding, tin be done very cheaply, or you can pay a little bit more to get a drag and drop website editor. You should write everything nearly how to utilize the code on the website. After that, you should share it on forums and social media sites. If you have created a real program in your language, this might help, because people see it is a good language.
-
Question
Where do I program a new language on a PC?
You lot can utilise freeware similar Sublime Text and ConTEXT, Notepad++, or fifty-fifty only Notepad to get started!
-
Question
What can I exam the programming language on? What tools can I apply?
Create some examples to test your compiler/interpreter on. Begin elementary, and after that gradually build up. Then you use a tool for testing, in that location are many free tools to utilise, for example, JUnit for Java, Jest for Javascript and Unittest for Python.
-
Question
How do I start learning a programming language?
-
Question
Tin can I make a new programming language on a Chromebook?
Of course, as long as yous take access to Javascript, Python, C#, or another programming language. To make a programming language, you need another programming language.
-
Question
Is there any specific language that is easy to make a new language on, and how would I do that?
Java is useful because of the many tools available. In item a very famous tool called "ANTLR" is bachelor for generating major components of compilers and interpreters.
-
Question
Can I make a new language without using another programming language?
Other programming languages can assistance specify the syntax (rules) in your programming linguistic communication. Information technology volition help to learn Coffee, C++, Python, etc. Programming languages are meant to solve problems, and so focus on that when yous're working on yours.
-
Question
What should I learn to understand language designing?
You could take a class at your local college, university or trade school, or search for information online.
-
Question
What linguistic communication should I use to build information technology?
You can utilize any language you want, though C++ or Java are recommended. You can then either build a run time or create a platform-specific compiler. PSCs are used to create programs such as operating systems and firmware.
See more answers
Inquire a Question
200 characters left
Include your electronic mail address to get a bulletin when this question is answered.
Submit
Advertisement
Video
-
Know your target platform (operating system and libraries) for your compiler/interpreter, later all, you lot are going to use it and manipulate it.
-
Start by designing your language and don't write any lawmaking, until yous are satisfied and have answered all (or almost) of the questions or problems related to your design since it's easier to change the design before than afterward.
Thank you for submitting a tip for review!
Advertising
-
Remember if you really need a new linguistic communication, and what your language has of new that other languages don't have (It may exist a combination of features or a single feature).
-
Writing languages is difficult if you don't know what you're doing. It takes a lot of practice, too.
-
Prepare to spend some time in language design, since you lot won't have a run a risk to change your linguistic communication once you've written the compiler and past the design point.
-
Don't effort to base your features into a union of several languages, similar saying that your language will be a spousal relationship of language X, language Y and linguistic communication Z. History has shown the states that languages created in such a way will never find success, or everyone would be programming PL/i instead of something based on C.
Advertisement
Things Yous'll Need
- Patience.
- Knowledge about language features and language design (you lot may desire to read Programming Language Design Concepts from David A. Watt).
- Knowledge about compiler theory (since you volition be writing a compiler/interpreter for your language and your implementation volition be the reference implementation).
- Uses for your language (remember that some of the most used languages like C or Lisp were created in order to do something specific like creating Unix or doing symbolic computation).
About This Commodity
Thanks to all authors for creating a page that has been read 381,692 times.
Is this article upward to date?
shackelforddreptur.blogspot.com
Source: https://www.wikihow.com/Create-a-Programming-Language
0 Response to "Can I Built a Programming Language From Scratch"
Post a Comment