Page 1 of 1

Emacs?

Posted: Wed Dec 24, 2003 2:38 pm
by darklife
I'm designing a portable programming language with its own proprietary syntax. I started to make a DOS based IDE in VBDOS (yes, VB for DOS) and it really sucks. Since I plan to port versions to Linux and other OS's, should I use EMacs? I've never used EMacs as much as I should. Can it be programmed to show different colors for keywords and stuff like that? How about Micro Emacs?
BTW: VBDOS is so limited it's not even funny. Since when is a 32k max multiline text box useful for REAL editing? lol.
Thanks.

Re:Emacs?

Posted: Tue Dec 30, 2003 11:03 am
by Tim
The text editor you use doesn't matter, but the programming language, compiler, and style of programming do. C and C++ are the most portable widespread programming languages, so I suggest you move to either of those. Once you've done that, you can use any editor you want to create the source files (except maybe VB).

Re:Emacs?

Posted: Wed Dec 31, 2003 11:12 pm
by darklife
It's a new programming language and I'm not about to write another C compiler :P (though I do like C)
Most of this language will be high level syntax and some low level stuff is optional to the programmer for non portability purposes. I'm worried about an editor not so much for other people, but for me. Others can use whatever they want with my compiler, but I personally would like something like Emacs that allows syntax highlighting for new language syntax, ie: undeveloped programming languages.
.....
So I guess what I'm asking is...
How do/can I change the colored keywords in Emacs for a non-existant language?
So if it found a keyword in the editor like "COW" it will highlite it blue, and "PIG" red, or whatever.
Thanks.

Re:Emacs?

Posted: Thu Jan 01, 2004 9:17 am
by creichen
Hi,

what you want is a new 'major mode' for EMACS. If you google for that for a bit, you should find lots of documentation and examples, and possibly a tutorial or two as well. I don't know about MicroEmacs, but both the GNU and the Lucid variants of EMACS (the latter is commonly called XEmacs these days) are scripted in a LISP variant, called 'elisp'. Like practically all versions of LISP it is extremely convenient to use and debug for small pieces of code, though you may find the lack of static type checking disturbing for larger chunks.

On the other hand, you probably don't want to write any larger chunks, unless you want fancy features like a type inference module (or something that tells the type of all built-in entities, as in Haskell-mode), fancy indentation (Haskell mode is another excellent example of this, but I find it a little too fancy to be able to iterate through several possible indentations), or a class browser (you should adapt the existing one if you're working on an OO language or a functional language with type classes, though, as that should be much less work than writing it from scratch).

If you stick with GNU or Lucid EMACS, you'll find that you can script it to do everything you'd like to do (assuming that what you'd like to do _can_ be written as a program, and can be computed as fast as you'd like it to be computed-- EMACS won't magically solve unsolvable problems like System F type inference for you, of course ;-)

Here's a major mode I wrote:
http://www-plan.cs.colorado.edu/reichenb/lido-mode.el

(This is for LIDO, the core language used by the Eli compiler generator. The major mode does not include code for automatic indentation, though.)


-- Christoph

Re:Emacs?

Posted: Thu Jan 01, 2004 9:22 am
by creichen
Hi,
Tim Robinson wrote: The text editor you use doesn't matter, but the programming language, compiler, and style of programming do. C and C++ are the most portable widespread programming languages, so I suggest you move to either of those. Once you've done that, you can use any editor you want to create the source files (except maybe VB).
I find it disturbing that a moderator of this board would suggest the use of C or C++ as default programming languages in our time and age.

-- Christoph

Re:Emacs?

Posted: Thu Jan 01, 2004 2:35 pm
by Tim
I suggest them simply because they are the default programming languages.