views:

728

answers:

3

When I saw this article about using a python-like sintax (indentation based, without curly braces, syntax) for C#, I begun to wonder: can I have an IDE that parses and compiles it?

+2  A: 

What about Iron Python? It's python for dotnet.

You can also check out Delphi Prism (runs as a plugin for Visual Studio) if you don't like braces. It can do everything that C# does, plus a few extra things.

Wouter van Nifterick
Iron Python is just a command line interpreter, and doesn't integrates to Visual Studio. Delphi uses "begin" and "end" instead of braces, which is worse.
Jader Dias
+2  A: 

: can I have an IDE that parses and compiles it?

First off, a bit of pedantry. An IDE neither parses nor compiles.

I would either suggest to use Iron Python or Delphi Prism (as Wouter suggested faster) or what about this: You use Notepad++ as an IDE and write a small tool that automatically adds the brackets based on the intention before the code is compiled. I think that this can be done within one code "search and replace traversal":

For example:

if true
   for each a in b
       foo();
 foo();

The code simply scans each line and adds an opening bracket if: The code in the currentline is further intended than the code in the previous line:

if true
   {for each a in b
       {foo();
 foo();

And adds a closing bracket wherever the code of the next line is less intended than in the current line. - Store the indentation depth (I would recommend a stackbased system)!

if true
   {for each a in b
       {foo();}
   }
 foo();

And so on... The problems with Namespaces and "Using" can also be solved that way.

Chris
According to WikipediaAn IDE normally consists of a: * source code editor, * compiler and/or interpreter, * build automation tools, and * debugger (usually).
Jader Dias
That's why it's called "Integrated" Development Enviroment
Jader Dias
I agree with Chris. Thinking of the IDE as a compiler is not smart. Sure you can run a compile from inside the IDE but you can also run the compile outside of the IDE. I suspect in most cases, the IDE actually runs the command line compiler, in which case the real compiler is the command line tool.
jussij
+2  A: 

Hi Jader, sorry for the delayed reply. I posted an article here that talks about structured editors. Unfortunately it's still in early prototype stages, but can give you an idea of how to build such an editor. I've also published the sources and binaries here.

Let me know if you have any questions.

Kirill Osenkov