Re: An Erlang IDE and interactive shell

2010-05-02 Thread Jeff Massung
On Sun, May 2, 2010 at 9:05 AM, Andre Garzia  wrote:

>
> This is wonderful! Can you write some words on how you're communicating
> with
> the REPL, are you using something like "open process" or is it a TCP/IP
> exchange like SLIME & Friends.
>

I'm using open process with read/write process as well. There's just a
message loop running in the background periodically checking for more data
from the Erlang shell. Something akin to:

on pingShell
  if sErl is not among the lines of the openProcesses then
exit pingShell
  end if

  read from process sErl until empty

  ## .. put it into the terminal shell and scroll it down ..

  send "pingShell" to me in 200 milliseconds
end pingShell



> About your colorization, is that a Rev field with some kind of HTMLText set
> with that disclosure triangle being an image or is it something like
> RevBrowser window?
>


It's just a simple Rev field. Nothing special about it other than there is
no background (it is not opaque and I turned off the showBorder property.
The background is just a rectangle graphic with a gradient applied to it.

Erlang syntax is pretty simple because it doesn't allow for multi-line
comments. For that reason, highlighting a single line as you type is fairly
trivial. I tokenize each line with a set of very simple regular expressions.
After the line is tokenized I end up with a token list that looks something
like this:

decl,1,8
keyword,10,14
string,21,34

After that, it's just a simple loop with a switch statement re-colorizing
the line based on the token type and where it happens to be.

As for the disclosure triangle, well, that's a bit of a joke for me and my
friends. Rev doesn't allow for color cursors [in 4.0] and I don't want to
use the developer preview quite yet, and with the dark background the mouse
can get lost in the editor. The triangle just follows the mouse so it's
easier to find. Once I get 4.5 and can drop in the color cursor I want it
will be much nicer.


I am building a little editor to talk to ARC (http://arclanguage.org) so I'd
> really like your thoughts!
>


Ah yes, Paul Graham's little toy. ;-)

If you haven't looked at it yet, I'd highly recommend Ypsilon over Arc (a
Scheme implementation that's quite exceptional).

Regardless of whatever language you use, something I implemented as a test
in my Erlang editor that turned into one heluva kick ass feature was
shift+return...

Basically, any line you are editing, just hit shift+return and it will
highlight and send that line to the REPL of the running shell so you can see
what happens (in Lisp/Scheme I'd probably take it a step further and make it
match the nearest ()'s and send the entire block of text).

Better still, my friends and I wanted to have a way of sending example code
over to the REPL as well within our sources without actually corrupting the
source file and breaking compilation. For that reason, I also made it so
that lines that were commented in a special way could also be sent over as
commands. It's amazing how much more readable the source code is when you
can directly show the reader how to use it and they can even test it out
immediately. For example (from the screenshot):

pips () -> [2,3,4,5,6,7,8,9,10,jack,queen,king,ace].
suits () -> [clubs,diamonds,hearts,spades].
deck () -> [{Pip,Suit} || Pip <- pips(), Suit <- suits()].

% Use deck() to generate a list of all cards...
%-poker:deck().

The "%" token is the beginning of a comment. But, if you begin your comment
with "%-" you can also execute it on the REPL by using shift+return. So you
can compile the code and try it out without editing anything. It has
improved productivity considerably!



> As for Erlang, I think it is really cool, almost bought that O'Reilly
> Erlang
> book last week, I have some concurrency problems to solve and the current C
> code is almost unmaintainable.
>


Erlang takes a little getting used to since it's functional. But the message
passing paradigm is quite powerful and the Erlang VM is unbelievably good at
handling thousands and thousands of processes running concurrently. If you
do anything with web servers, I'd recommend looking at Erlang as a web
server. It's wonderful.


Hope this helps,

Jeff M.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: An Erlang IDE and interactive shell

2010-05-02 Thread Andre Garzia
Jeff,

This is wonderful! Can you write some words on how you're communicating with
the REPL, are you using something like "open process" or is it a TCP/IP
exchange like SLIME & Friends.

About your colorization, is that a Rev field with some kind of HTMLText set
with that disclosure triangle being an image or is it something like
RevBrowser window?

I am building a little editor to talk to ARC (http://arclanguage.org) so I'd
really like your thoughts!

As for Erlang, I think it is really cool, almost bought that O'Reilly Erlang
book last week, I have some concurrency problems to solve and the current C
code is almost unmaintainable.

I think creating your own tools to solve jobs like these is one of the
places that Rev trully shines.

Cheers and congratulations on your editor!

Andre

On Sat, May 1, 2010 at 11:56 PM, Jeff Massung  wrote:

> I'm not sure if anyone else here also happens to program in Erlang, but
> it's
> something I do quite often and I really hate that there's no real good IDE
> for it. Anyway, last weekend I decided to put one together in Rev... just
> something simple that had syntax highlighting and would allow me to
> interact
> with the Erlang shell like a simple REPL, but from the editor:
>
> http://massj.on-rev.com/im/Erlang_IDE.png
>
> Current feature set:
>
> * Scratchpad mode where nothing is saved
> * Syntax highlighting (as you type)
> * Tabbed editor let's you edit many files at once
> * Compile modules directly to a running Erlang shell
> * Send any line of code in the editor directly to the REPL
> * Errors from the shell are captured and turn into links to the source
> files
> * See a list of all running, named processes
>
> If no one here programs Erlang, well, just know that this was another
> shining point for Rev... an entire editor in a weekend, communicating with
> another programming language's REPL shell. But, should someone here be
> interested in trying it out to help offer some wishlist items, etc, please
> feel free to email me and let me know your operating system and I'll send
> you a compiled version to test.
>
> Cheers,
>
> Jeff M.
> ___
> use-revolution mailing list
> use-revolution@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



-- 
http://www.andregarzia.com All We Do Is Code.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: An Erlang IDE and interactive shell

2010-05-01 Thread Jerry Daniels
VERY cool!

Best,

Jerry Daniels

Use tRev's buy link during your free trial to get 20% off:
http://reveditor.com/tag/shouldiswitch

On May 1, 2010, at 9:56 PM, Jeff Massung  wrote:

> I'm not sure if anyone else here also happens to program in Erlang, but it's
> something I do quite often and I really hate that there's no real good IDE
> for it. Anyway, last weekend I decided to put one together in Rev... just
> something simple that had syntax highlighting and would allow me to interact
> with the Erlang shell like a simple REPL, but from the editor:
> 
> http://massj.on-rev.com/im/Erlang_IDE.png
> 
> Current feature set:
> 
> * Scratchpad mode where nothing is saved
> * Syntax highlighting (as you type)
> * Tabbed editor let's you edit many files at once
> * Compile modules directly to a running Erlang shell
> * Send any line of code in the editor directly to the REPL
> * Errors from the shell are captured and turn into links to the source files
> * See a list of all running, named processes
> 
> If no one here programs Erlang, well, just know that this was another
> shining point for Rev... an entire editor in a weekend, communicating with
> another programming language's REPL shell. But, should someone here be
> interested in trying it out to help offer some wishlist items, etc, please
> feel free to email me and let me know your operating system and I'll send
> you a compiled version to test.
> 
> Cheers,
> 
> Jeff M.
> ___
> use-revolution mailing list
> use-revolution@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


An Erlang IDE and interactive shell

2010-05-01 Thread Jeff Massung
I'm not sure if anyone else here also happens to program in Erlang, but it's
something I do quite often and I really hate that there's no real good IDE
for it. Anyway, last weekend I decided to put one together in Rev... just
something simple that had syntax highlighting and would allow me to interact
with the Erlang shell like a simple REPL, but from the editor:

http://massj.on-rev.com/im/Erlang_IDE.png

Current feature set:

* Scratchpad mode where nothing is saved
* Syntax highlighting (as you type)
* Tabbed editor let's you edit many files at once
* Compile modules directly to a running Erlang shell
* Send any line of code in the editor directly to the REPL
* Errors from the shell are captured and turn into links to the source files
* See a list of all running, named processes

If no one here programs Erlang, well, just know that this was another
shining point for Rev... an entire editor in a weekend, communicating with
another programming language's REPL shell. But, should someone here be
interested in trying it out to help offer some wishlist items, etc, please
feel free to email me and let me know your operating system and I'll send
you a compiled version to test.

Cheers,

Jeff M.
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution