Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / Code Editor + Interpreter + Image Output?

Author
Message
Mr Kohlenstoff
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Germany
Posted: 18th Nov 2012 17:35
Hi,

I'd like to achieve the following situation:

I need an IDE that includes a text editor for source codes as well as a second panel containing an image. The idea is that the code has to generate an image, which will then be shown in the panel. Hence an interpreter should be able to run the code and redirect the code's output into the preview panel.

The language doesn't need to be DBPro (I think there is no DBP interpreter to begin with, right?), in fact I'd prefer Scala since it's not only faster when it comes to handling large amounts of data (well, I didn't actually compare them, that's just my impression), but it also has certain features that are very handy when it comes to image programming (such as very intuitive function pointers etc.)... and, well, there is a Scala interpreter out there I could use.

However, while I've worked with Scala, I have no idea how to use its interpreter, nor do I know how to embed those things into an editor.

So... my question is, how would I possibly achieve that? I'm not asking for a step by step tutorial here, just a general direction that I could take.

I guess using Netbeans is one way to do it. But since I've had rather bad experiences with Netbeans I'd prefer a different solution.

I hope I made the problem clear enough. Otherwise I might just post an image explaining the concept, if neccessary. So... your turn, any help is greatly appreciated!

cheers
MrK

Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 18th Nov 2012 18:50
Well, Freedom engine is kinda like what you're asking for, apart from the more advanced concepts such as function pointers.

If you can figure out the scala interpreter (or any other, you might want to settle for a language like Lua or Python for this kind of thing), you can hook it up to a graphics engine and show the output in a different panel. Blue GUI, or any other UI system you'll find around here would be fine for the text editor itself. The image panel could just be the backdrop.

Are you wanting to show the output as you type?

"everyone forgets a semi-colon sometimes." - Phaelax
Mr Kohlenstoff
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Germany
Posted: 18th Nov 2012 19:32
Quote: "Are you wanting to show the output as you type?"


I guess not. What I'm up to is simply a code editor with "Run"-button (or pressing F5 or whatever) that results in the code being executed and the output being shown in the preview panel.
Although it certainly would be nice to be able to manipulate individual values inside the code interactively while seeing the results of this action in real time. But I could live without that.

bitJericho
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 18th Nov 2012 21:36 Edited at: 18th Nov 2012 21:37
http://www.codecommit.com/blog/scala/scala-as-a-scripting-language

That might help you.

There's a few ways to do this.

You can write your own interpreter (and thus design your own or implement a language). Antlr could help you in that regard.

You can call a language interpreter externally passing any data needed back and forth, similar to how apache might call on php and php returns the html output back to apache. (you would then write a set of standard classes and document an API that the end user would use to create the appropriate output)

You can find a scripting language that you can directly implement via a library like Lua or the method discussed in the link above.

Visit my blog http://www.canales.me.
Red Eye
16
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 21st Nov 2012 15:58
http://sam.nipl.net/brace/

Here is something upcoming. Don“t know if this is what you mean.
the_winch
22
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 21st Nov 2012 23:27
http://processing.org/

Might provide some inspiration at least.

By way of demonstration, he emitted a batlike squeak that was indeed bothersome.
Mr Kohlenstoff
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Germany
Posted: 27th Nov 2012 18:27
OK guys, thank you for your help. I haven't heared of those 2 programs before, but they definitely go in the right direction. However, the codes used to generate those images seem kind of ugly to me - too many redundant loops and all that, which is why I wanted to use something like Scala to begin with.

Luckily I found a solution - not a great one, but it works. My "IDE" consists of two components now, a small window I created with DBPro, and Notepad++ as the code editor.

Right now (in its pretty unfinished but kind of working form) it looks like this:



When I click on one of the Files in the list on the left side, DBPro will execute the respective text file, which leads to Notepad++ opening it in a new tab automatically. When I press the Build or Run-Button on the left side, DBPro creates a batch-file that contains the scala compile and execute instructions required to compile and run the selected scala file. Finally, the output of scala editor and interpreter are printed to the small window in the lower left corner (and still have to be formatted properly).
After running a code, the image in the upper left corner is automatically updated by reading it from the hard disk, which obviously only works when the scala-code exports an output image beforehand, which happens in line 41 in the screenshot.


Well, this is not a WIP post or anything, I just thought somebody might be interested in my solution.

Thank you and have a nice day!

Login to post a reply

Server time is: 2025-05-20 07:24:45
Your offset time is: 2025-05-20 07:24:45