Remember, this is using python. Well, I was fiddling around with an app I made called Pyline, today. It is a command line-like interface, with some cool features. However, I had an idea while making it: Since its like a "OS", wont it have its own language?
Well, I have seen some articles online on how to make a interpreter, and parser, and compiler, but it wasn't really readable for me. All I saw was a crapload of code. I am one of those guys who need comments or a readme or SOME form or communication towards the user without the code itself, so I think that Stack Overflow would be great for a teenager like me. Can I get some help?
-
4What does "Since its like a "OS", wont it have its own language?" mean, btw?Bart Kiers– Bart Kiers2010年06月25日 06:24:56 +00:00Commented Jun 25, 2010 at 6:24
-
if the question is "Can I get some help?" the answer is yes, provided you ask the right questions.fortran– fortran2010年06月25日 06:41:24 +00:00Commented Jun 25, 2010 at 6:41
-
3@Galilsnap: All (99%) of operating systems have a foundation in C, with some guts of assembler to make system level stuff work. This is a completely different topic than creating a programming language.Yann Ramin– Yann Ramin2010年06月25日 06:56:35 +00:00Commented Jun 25, 2010 at 6:56
-
3If you refer to the application by "OS", then "its own language" is Python, of course, since you coded the app in that language. Presumably that's the "native" language you mean.Fusyion– Fusyion2010年06月25日 07:29:04 +00:00Commented Jun 25, 2010 at 7:29
-
2An interactive interpreter that takes commands as input is called a Shell. On Windows this is the CMD shell, on Linux it's usualy Bash. These are actually just applications that run on the operating system. They have built-in commands and also provide a convenient way to run other programs. GUI desktops are graphical shells that allow you to do things using a mouse instead of typing commands. I'd suggest reading up on OS architecture. Wikipedia is a great place to start.Simon Hibbs– Simon Hibbs2010年06月25日 08:22:07 +00:00Commented Jun 25, 2010 at 8:22
4 Answers 4
You need some grounding first in order to actually create a programming language. I strongly suggest picking up a copy of Programming Language Pragmatics, which is quite readable (much more so than the Dragon book) and suitable for self study.
Once you are ready to start messing with parsers, ANTLR is the "gold" standard for parser generators in terms of usability (though flex+bison/yacc are quite capable).
Comments
I just came by Xtext, a language development framework. Perhaps that's something you might want to take a look at.
Considering Python you might find it instructive to implement a version of Logo. If you want, you can skip the parsing/lexing stage for now and come up with a object oriented version first to get you going if your OOP skills are up to it. Later on you can hook it up with some graphics library to actually draw something.
In addition to Logo you might want to check out L-systems. See particularly The Algorithmic Beauty of Plants for inspiration.
Comments
Like theatrus, I'd suggest starting with a good book on the subject. I can definitely recommend Language Implementation Patterns by Terence Parr (the man behind ANTLR, a common parser generator).
1 Comment
See Peter Norvig's Scheme interpreter in 2 pages of Python with plenty of explanation. There's also a fancier version linked from there, worth reading once you've grokked the simpler one.
Comments
Explore related questions
See similar questions with these tags.