I would like to create my own programming language. Maybe not exactly a programming language from scratch but maybe base it on another language.
I\'ve heard of Yacc. So
You might consider learning to build a compiler from a fabulous 1964 (yes, you read that right) paper META II: A Syntax-Oriented Compiler Writing Language on how to build "meta compilers".
This paper contains, in 10 pages, a compiler writing philosophy, a definition of a virtual compiler instruction set that is easy to implement, a compiler-compiler, and an example compiler built using the compiler-compiler.
I learned initially how to build compilers from this paper back in 1970 odd. It is astonishing how clever and conceptually simple it is.
If there was a paper I'd make every computer science student read, this would be it.
You can get the paper, see a tutorial and an implementation of MetaII in JavaScript here. The guy behind the tutorial is Dr. James Neighbors, source of the term "domain analysis".
The most easy option would probably be to create a program in Java that reads text files and if it finds something it would start writing a .java file and write what it basically means in Java. So for example my a file called main.boss could be:
write Hello world
write Bye!
And my java program would cycle through it and detect the word write and then go one space after it and read the text until the end of the line. Meaning it would get "Hello world" and "Bye!". Because says "write" it would then write a main.java file with this in it:
public class Main
{
System.out.println("Hello world");
System.out.println("Bye!");
}
Then you could have a .bat file that is executed by your java program and it would set classpath, compile the file, and turn it into a .jar file. It could possibly bundle a program like Launch4J with it so it could have an option to turn the .jar into a .exe.
Defining your own programming language is an interesting challenge and test of creativity. A question you should consider is the extent to which you want the "language" to operate as something that completely analyzes a program before trying to execute anything, something that interprets commands in context-free fashion as it's going along, or something like Forth or PostScript in which commands are processed as they come from an input stream, but which has the ability to append input to a list, or to read commands from a list as though they were coming from an input stream, this allowing one to effectively define procedures by reading all the instructions into a list, and then later executing all the instructions in the list.
Another related question is whether you want your language to be practical for large-scale application development. If an application won't need more than 26 variables, for example, using a fixed mapping of the letters a-z to 26 variables may be simpler than trying to implement a symbol table or allocate space for variables. Local variables and parameter passing can be somewhat complicated; having all variable be in one global scope and requiring that code pass parameters using those global variables will simplify the language design, but writing code in such a language can easily become unmanageable especially if one wants to avoid defining an excessive number of single-use variables [e.g. because there are only 26 variables available].
I've used a fair number of domain-specific languages, including some I've designed; I've liked some and disliked others. The most important thing in designing a language is to decide one's objectives. That's not to suggest that defining the objectives will make everything else fall into place, but if you don't have a sense of your objectives you'll have no way of knowing which design ideas will let you meet those objectives and should be followed, and which design ideas would be incompatible with your objectives and should be abandoned.
I created a very small language in yacc for a lecture in one of the higher semesters in college. It is a very complicated thing, I wouldn't recommend to do it just like that.
You could create a library, for example in C#, defining some simple instructions like "message(string)" and mapping them to more complex things like opening a window and displaying the message. It would not be an independent language, but you could define your own basic instructions, even if they just wrap basic instructions of the used language.
I made a small programming language that makes the user program a pattern to control the lights of the keyboard (caps lock,etc) . It plays a light show . I based it on VBS.
I am the creator of the web based programming language Jetsam. To create your own programming language first you need to go through all kinds of different programming languages, such as C to C++, Java, QML, HTML, JavaScript, Ruby, Python, and some others. I created it using web and that language is just working on the web. Mess around all these languages and go to their base. You may have a look at book "How to create your own freaking awesome programming language". There is a website which also teaches you how to create a programming language. Hope this helps you.