I found a neat project, it's a REPL (read-eval-print-loop, like the Python shell) for C++. It seems pretty sweet:
http://www.artificialworlds.net/wiki/IGCC/IGCC
The example I thought was pretty cool was handling templates and errors:

Code:
 $ ./igcc
 g++> #include <map>
 g++> map<string,int> hits;
 g++> hits["foo"] = 12;
 g++> hits["bar"] = 15;
 g++> for( map<string,int>::iterator it = hits.begin(); it != hits.end(); ++it )
 [Compile error - type .e to see it.]
 g++> {
 [Compile error - type .e to see it.]
 g++>    cout << it->first << " " << it->second << endl;
 [Compile error - type .e to see it.]
 g++> }
 bar 15
 foo 12
 g++>

It seems like a nice thing to have if you need to quickly try out some C++ code.
This is awesome; it reminds me very much of the Python shell, as you said. I will definitely be grabbing this to play with code that I'm developing! I'm trying to think how difficult this must have been to make to be able to compile on the fly, and my mind is boggling. Thanks very much for sharing.
Wow, that's definitely awesome-looking and gives me the urge to try some C++. However, the fact that it complains about errors while one enters multi-line constructs seems somewhat annoying.
calcdude84se wrote:
Wow, that's definitely awesome-looking and gives me the urge to try some C++. However, the fact that it complains about errors while one enters multi-line constructs seems somewhat annoying.
I agree that it could be a bit annoying, but there's really no way else to deal with it in my opinion other than having a way to represent a special mid-block line return, and if you're arbitrarily deep in the middle of a block, that could be significantly awkward, in my opinion;.
Do what bash does with quoted strings (or python with indentation), and just keep a stack of open things that need to be closed and build up a buffer before executing.
elfprince13 wrote:
Do what bash does with quoted strings (or python with indentation), and just keep a stack of open things that need to be closed and build up a buffer before executing.
Yeah, but if you have to wait for every nested curly-brace structure to be closed before any of it will execute? I don't think that's a very fun idea at all. Sad
KermMartian wrote:
elfprince13 wrote:
Do what bash does with quoted strings (or python with indentation), and just keep a stack of open things that need to be closed and build up a buffer before executing.
Yeah, but if you have to wait for every nested curly-brace structure to be closed before any of it will execute? I don't think that's a very fun idea at all. Sad


Python does it that way and everything works okay...
elfprince13 wrote:
Python does it that way and everything works okay...
Are you sure that it makes you back out of all the levels before it will execute any of them instead of executing each completed level as you back outwards? I need to investigate this more, I tihnk.
KermMartian wrote:
elfprince13 wrote:
Python does it that way and everything works okay...
Are you sure that it makes you back out of all the levels before it will execute any of them instead of executing each completed level as you back outwards? I need to investigate this more, I tihnk.


yes. I write text-processing loops for getting log files from various programs into spreadsheet programs for analysis all the time with the python interactive shell.
Good to know, thanks for the clarification. I guess that makes sense for Python in a sense, because there's no explicit loop ending other than having a new line not indented, but I still don't exactly understand why that's necessary.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement