views:

75

answers:

2

Hey as a project to improve my programing skills I've begun programing a nice code editor in python to teach myself project management, version control, and gui programming. I was wanting to utilize syntax files made for other programs so I could have a large collection already. I was wondering if there was any kind of universal syntax file format much in the same sense as .odt files. I heard of one once in a forum, it had a website, but I can't remember it now. If not I may just try to use gedit syntax files or geany.

thanks

A: 

Not sure what .odt has to do with any of this.

I could see some sort of BNF being able to describe (almost) any syntax: Just run the text and the BNF through a parser, and apply a color scheme to the terminals. You could even get a bit more fancy, since you'd have the syntax tree.

In reality, I think most syntax files take an easier approach, such as regular expressions. This would put then somewhere above regular expressions but not really quite context-free in terms of power.

As for file formats, if you re-use something that exists, then you can just loot and pillage (subject to license agreements) their syntax file data.

Thanatos
ODT is a standard for documents. Hes looking for a standard for source code syntax. That is the relevance.
mathepic
+2  A: 

If you're planning to do syntax highlighting, check out Pygments, especially the bit about lexers.

Since you mentioned Geany, you might want to look at the Scintilla docs. (Geany is built upon Scintilla).

You might find this post interesting.

Also, be sure to get familiar with the venerable lex and yacc.

Forest