I decided that from today on I will be spending at least one our to develop a simple language. I don't know how to do it but I am willing to learn the basics in a month or so.
Here is what I have decided about the language. The language will be similar to C but a lot smaller. It will have following structures:
- Scalar values (1,2,3...) - only integers for now
- Variables (a,b,c...) - dynamic variables (Will hold only integers for now)
- Addition (+) - addition
- Subtraction (-) - subtraction
- Functions (function, return) - functions will accept dynamic variables and return any value or a void
- Core functions - a print() function and a general way to add core functions
- No semicolons
Example:
function calc(a, b)
{
var c = 5
c = c + a - b
return c
}
var answer = calc(5, 7)
print(sum)I will write the compiler and core functions in Java on JVM, because I'm running Ubuntu at my desktop. There are talks that .NET and CLR is be a better suit for developing a language, but I am afraid that Mono will be too buggy for this.
Wish me luck and post any advices in comments.

No comments:
Post a Comment