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?
views:
728answers:
3What 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.
: 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.
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.