librelist archives

« back to archive

Emacs Synax Highlighting

Emacs Synax Highlighting

From:
Uwe Dauernheim
Date:
2010-09-25 @ 16:22
Hej there,

I am new to the mailing list and crawling through it at the moment. So 
maybe I will find the answer somewhere soon. Besides, I would like to ask 
if the status about Efene and Emacs mentioned on the FAQ list under 
„Tools“ has changed? Does syntax highlighting for Emacs already exists / 
is there an Emacs mode already?

Cheers,
Uwe

Re: [efene] Emacs Synax Highlighting

From:
Mariano Guerra
Date:
2010-09-25 @ 19:53
On Sat, Sep 25, 2010 at 1:22 PM, Uwe Dauernheim <uwe@dauernheim.net> wrote:
> Hej there,
>
> I am new to the mailing list and crawling through it at the moment. So 
maybe I will find the answer somewhere soon. Besides, I would like to ask 
if the status about Efene and Emacs mentioned on the FAQ list under 
„Tools“ has changed? Does syntax highlighting for Emacs already exists / 
is there an Emacs mode already?
>
> Cheers,
> Uwe

Hi, welcome to the mailing list!

the status of all syntax highlighters is zero, except for vim, that is
the one I use. If you want to help us building it (it should't be too
hard) then it would be great.

if you have any question please let me know.

Overloaded fun declaration

From:
Uwe Dauernheim
Date:
2010-09-25 @ 22:25
Hej,

what do you think of "Thorn"[1]s overloaded fun syntax with a boolean or 
("|"). It brings back nice alignment with the fn keyword start from 
Erlang, and makes it look like a subtree folder structure. Example below:

fib = fn(0) { 0 }
fn(1) { 1 }
fn(N) when N > 0 { fib(N-1) + fib(N-2) }

vs.

fib = fn(0) { 0 }
 | fn(1) { 1 }
 | fn(N) when N > 0 { fib(N-1) + fib(N-2) }

[1] http://www.thorn-lang.org/

/Uwe
>> 
>> 

Re: [efene] Overloaded fun declaration

From:
Mariano Guerra
Date:
2010-09-25 @ 23:05
On Sat, Sep 25, 2010 at 7:25 PM, Uwe Dauernheim <uwe@dauernheim.net> wrote:
>
> Hej,
>
> what do you think of "Thorn"[1]s overloaded fun syntax with a boolean or
("|"). It brings back nice alignment with the fn keyword start from 
Erlang, and makes it look like a subtree folder structure. Example below:
>
> fib = fn(0) { 0 }
> fn(1) { 1 }
> fn(N) when N > 0 { fib(N-1) + fib(N-2) }
>
> vs.
>
> fib = fn(0) { 0 }
>  | fn(1) { 1 }
>  | fn(N) when N > 0 { fib(N-1) + fib(N-2) }
>
> [1] http://www.thorn-lang.org/

when efene started the definition was:

fib = fn (0) { 0 }
(1) { 1 }
(N) when N > 0 { fib(N - 1) + fib(N - 2) }

I added the fn keyword to make it more uniform (so all the function
clauses look the same after the assignment)

fib =
fn (0) { 0 }
fn (1) { 1 }
fn (N) when N > 0 { fib(N - 1) + fib(N - 2) }

that means that the fn keyword has the same intention as "|", adding
the "|" would add another thing to type that doesn't add any
information and makes the syntax more complex. I like the folder like
indentation but I think that the example above or the following get
the same uniformity without adding more syntax:

fib =
 fn (0) { 0 }
 fn (1) { 1 }
 fn (N) when N > 0 { fib(N - 1) + fib(N - 2) }

what do you think?

Re: [efene] Overloaded fun declaration

From:
Uwe Dauernheim
Date:
2010-09-26 @ 07:15

26 sep 2010 kl. 01:05 skrev Mariano Guerra <luismarianoguerra@gmail.com>:

> On Sat, Sep 25, 2010 at 7:25 PM, Uwe Dauernheim <uwe@dauernheim.net> wrote:
>> 
>> Hej,
>> 
>> what do you think of "Thorn"[1]s overloaded fun syntax with a boolean 
or ("|"). It brings back nice alignment with the fn keyword start from 
Erlang, and makes it look like a subtree folder structure. Example below:
>> 
>> fib = fn(0) { 0 }
>> fn(1) { 1 }
>> fn(N) when N > 0 { fib(N-1) + fib(N-2) }
>> 
>> vs.
>> 
>> fib = fn(0) { 0 }
>>  | fn(1) { 1 }
>>  | fn(N) when N > 0 { fib(N-1) + fib(N-2) }
>> 
>> [1] http://www.thorn-lang.org/
> 
> when efene started the definition was:
> 
> fib = fn (0) { 0 }
> (1) { 1 }
> (N) when N > 0 { fib(N - 1) + fib(N - 2) }
> 
> I added the fn keyword to make it more uniform (so all the function
> clauses look the same after the assignment)
> 
> fib =
> fn (0) { 0 }
> fn (1) { 1 }
> fn (N) when N > 0 { fib(N - 1) + fib(N - 2) }
> 
> that means that the fn keyword has the same intention as "|", adding
> the "|" would add another thing to type that doesn't add any
> information and makes the syntax more complex. I like the folder like
> indentation but I think that the example above or the following get
> the same uniformity without adding more syntax:
> 
> fib =
> fn (0) { 0 }
> fn (1) { 1 }
> fn (N) when N > 0 { fib(N - 1) + fib(N - 2) }
> 
> what do you think?

I didn't think about the solution to break after the "=". Then it looks 
even better than a "|" and comes in almost identical to Erlang. Btw: I 
really like the fact that functions and lambada have the declaration 
syntax.

Re: [efene] Overloaded fun declaration

From:
Mariano Guerra
Date:
2010-09-26 @ 07:47
On Sun, Sep 26, 2010 at 4:15 AM, Uwe Dauernheim <uwe@dauernheim.net> wrote:
> 26 sep 2010 kl. 01:05 skrev Mariano Guerra <luismarianoguerra@gmail.com>:
>> fib =
>> fn (0) { 0 }
>> fn (1) { 1 }
>> fn (N) when N > 0 { fib(N - 1) + fib(N - 2) }
>>
>> what do you think?
>
> I didn't think about the solution to break after the "=". Then it looks 
even better than a "|" and comes in almost identical to Erlang. Btw: I 
really like the fact that functions and lambada have the declaration 
syntax.

Nice to know that you liked it.

about the function and lambda, that's the idea, to have a simple and
uniform syntax to make the erlang platform more attractive to more
people.

since there are only a few people in this mailing list and in general
interested in efene, I would like to know about any observations of
what you think should be improved.

Re: [efene] Emacs Synax Highlighting

From:
Uwe Dauernheim
Date:
2010-09-25 @ 22:08
Hej Mariano,

ok, I will try to have a first quick shoot on an Emacs mode and maybe a 
TextMate Bundle, depending on how much time I can spend. Do you suggest 
any specific version to start with? The latest? I mean, do you plan on 
reverting or heavily change some introduced syntax features?

/Uwe


25 sep 2010 kl. 21:53 skrev Mariano Guerra <luismarianoguerra@gmail.com>:

> On Sat, Sep 25, 2010 at 1:22 PM, Uwe Dauernheim <uwe@dauernheim.net> wrote:
>> Hej there,
>> 
>> I am new to the mailing list and crawling through it at the moment. So 
maybe I will find the answer somewhere soon. Besides, I would like to ask 
if the status about Efene and Emacs mentioned on the FAQ list under 
„Tools“ has changed? Does syntax highlighting for Emacs already exists / 
is there an Emacs mode already?
>> 
>> Cheers,
>> Uwe
> 
> Hi, welcome to the mailing list!
> 
> the status of all syntax highlighters is zero, except for vim, that is
> the one I use. If you want to help us building it (it should't be too
> hard) then it would be great.
> 
> if you have any question please let me know.

Re: [efene] Emacs Synax Highlighting

From:
Mariano Guerra
Date:
2010-09-25 @ 22:38
On Sat, Sep 25, 2010 at 7:08 PM, Uwe Dauernheim <uwe@dauernheim.net> wrote:
>
> Hej Mariano,
>
> ok, I will try to have a first quick shoot on an Emacs mode and maybe a 
TextMate Bundle, depending on how much time I can spend. Do you suggest 
any specific version to start with? The latest? I mean, do you plan on 
reverting or heavily change some introduced syntax features?
>

since some time ago efene is starting to settle in the current form,
I'm thinking on doing the 1.0 release in the following months. That
means that except I get some idea or advice efene syntax should stay
stable from now on.

thanks for the help!

Re: [efene] Emacs Synax Highlighting

From:
Uwe Dauernheim
Date:
2010-09-26 @ 18:37
On 26.09.2010, at 00:38, Mariano Guerra wrote:

> On Sat, Sep 25, 2010 at 7:08 PM, Uwe Dauernheim <uwe@dauernheim.net> wrote:
>> 
>> Hej Mariano,
>> 
>> ok, I will try to have a first quick shoot on an Emacs mode and maybe a
TextMate Bundle, depending on how much time I can spend. Do you suggest 
any specific version to start with? The latest? I mean, do you plan on 
reverting or heavily change some introduced syntax features?
>> 
> 
> since some time ago efene is starting to settle in the current form,
> I'm thinking on doing the 1.0 release in the following months. That
> means that except I get some idea or advice efene syntax should stay
> stable from now on.
> 
> thanks for the help!

At the moment I try to orientate myself on the current Erlang Emacs mode. 
The current erlang.el Emacs mode definition file is around 5400 LoC. I 
will try to strip that down to only syntax highlighting for a start and 
see how well it goes/applies. (I am not at all an elisp expert)

Re: [efene] Emacs Synax Highlighting

From:
Mariano Guerra
Date:
2010-09-26 @ 22:47
On Sun, Sep 26, 2010 at 3:37 PM, Uwe Dauernheim <uwe@dauernheim.net> wrote:
> At the moment I try to orientate myself on the current Erlang Emacs 
mode. The current erlang.el Emacs mode definition file is around 5400 LoC.
I will try to strip that down to only syntax highlighting for a start and 
see how well it goes/applies. (I am not at all an elisp expert)


I think you could check the javascript and python modes, if they are
simpler then it will be easier for you to modify them (since the
syntax is very similar).

Re: [efene] Emacs Synax Highlighting

From:
Uwe Dauernheim
Date:
2010-09-27 @ 11:25
On 27.09.2010, at 00:47, Mariano Guerra wrote:

> On Sun, Sep 26, 2010 at 3:37 PM, Uwe Dauernheim <uwe@dauernheim.net> wrote:
>> At the moment I try to orientate myself on the current Erlang Emacs 
mode. The current erlang.el Emacs mode definition file is around 5400 LoC.
I will try to strip that down to only syntax highlighting for a start and 
see how well it goes/applies. (I am not at all an elisp expert)
> 
> 
> I think you could check the javascript and python modes, if they are
> simpler then it will be easier for you to modify them (since the
> syntax is very similar).

Yes, looking at the Python mode file in the Emacs lib was the best way to 
go. I first tried to port the Erlang mode but it is a bit messy and more 
sophisticated (several layers of font-lock modes and a lot of RegExs). 
Then I picked an old Python mode (python-mode.el) which was also more than
what I needed.
Currently syntax highlighting is working (I stripped all the other 
features to really understand what’s going on in the Elisp file). Then I 
can start adding features to make it more behaving like the Erlang mode.
From now I will focus mostly on support for Ifene, as I currently believe 
it is the „better“ choice between i and e. But I will try to also have 
syntax highlighting for Efene if the JS mode is also easy, so I can see 
visually, which style do I appreciate most when developing.

@Mariano, can you send me or publish some screenshots how e.g. the bundled
ifn examples look like in VIM, so I can better understand what and how to 
highlight? I have the keyword list etc. but I feel this is a good help 
anyway.

/Uwe

Re: [efene] Emacs Synax Highlighting

From:
Mariano Guerra
Date:
2010-09-27 @ 22:58
On Mon, Sep 27, 2010 at 8:25 AM, Uwe Dauernheim <uwe@dauernheim.net> wrote:
> Yes, looking at the Python mode file in the Emacs lib was the best way 
to go. I first tried to port the Erlang mode but it is a bit messy and 
more sophisticated (several layers of font-lock modes and a lot of 
RegExs). Then I picked an old Python mode (python-mode.el) which was also 
more than what I needed.
> Currently syntax highlighting is working (I stripped all the other 
features to really understand what’s going on in the Elisp file). Then I 
can start adding features to make it more behaving like the Erlang mode.
> From now I will focus mostly on support for Ifene, as I currently 
believe it is the „better“ choice between i and e. But I will try to also 
have syntax highlighting for Efene if the JS mode is also easy, so I can 
see visually, which style do I appreciate most when developing.
>
> @Mariano, can you send me or publish some screenshots how e.g. the 
bundled ifn examples look like in VIM, so I can better understand what and
how to highlight? I have the keyword list etc. but I feel this is a good 
help anyway.

screenshot: http://marianoguerra.com.ar/efene/files/efene-vim.png

Re: [efene] Emacs Synax Highlighting

From:
Steve Freitas
Date:
2010-09-27 @ 01:06
  On 09/26/2010 11:37 AM, Uwe Dauernheim wrote:
> At the moment I try to orientate myself on the current Erlang Emacs 
mode. The current erlang.el Emacs mode definition file is around 5400 LoC.
I will try to strip that down to only syntax highlighting for a start and 
see how well it goes/applies. (I am not at all an elisp expert)

Hi Uwe,

I'm looking forward to a usable emacs mode myself, so I'll volunteer to 
try anything you can put together. And please don't forget ifene -- some 
of us love our whitespace! :-)

Steve

Lambdas in functions like lists:foldl/3 in ifene without '{...}'

From:
Uwe Dauernheim
Date:
2010-09-27 @ 13:44
Hej,

is it possible to have lambas in functions like lists:foldl/3 in ifene 
syntax without '{...}'? Like the following:

run = fn()
  fun = lists.fold(fn(E, Acc)
    io.format("~p~n", [Expr]), [], [])

# or

run = fn()
  fun = lists.fold(fn(E, Acc)
    io.format("~p~n", [Expr]),
  [], [])

# or

run = fn()
  fun = fn(E, Acc)
    io.format("~p~n", [Expr])
  lists.fold(fun:2, [], [])

Neither of them work for me, so I guess I haven’t declared the syntax 
correctly. I have some clues about the first two tries, but the last 
should work, or?

/Uwe

Re: [efene] Lambdas in functions like lists:foldl/3 in ifene without '{...}'

From:
Uwe Dauernheim
Date:
2010-09-27 @ 13:48
On 27.09.2010, at 15:44, Uwe Dauernheim wrote:

> Hej,
> 
> is it possible to have lambas in functions like lists:foldl/3 in ifene 
syntax without '{...}'? Like the following:
> 
> run = fn()
>  fun = lists.fold(fn(E, Acc)
>    io.format("~p~n", [Expr]), [], [])
> 
> # or
> 
> run = fn()
>  fun = lists.fold(fn(E, Acc)
>    io.format("~p~n", [Expr]),
>  [], [])
> 
> # or
> 
> run = fn()
>  fun = fn(E, Acc)
>    io.format("~p~n", [Expr])
>  lists.fold(fun:2, [], [])
> 
> Neither of them work for me, so I guess I haven’t declared the syntax 
correctly. I have some clues about the first two tries, but the last 
should work, or?
> 
> /Uwe

Ok, I was too quick and saw the error on the last example. It has to be:

run = fn()
  fun = fn(E, Acc)
    io.format("~p~n", [Expr])
  lists.fold(fn fun:2, [], [])

(...Besides they would all fail because Expr is not defined)

Re: [efene] Lambdas in functions like lists:foldl/3 in ifene without '{...}'

From:
Mariano Guerra
Date:
2010-09-27 @ 23:28
On Mon, Sep 27, 2010 at 10:48 AM, Uwe Dauernheim <uwe@dauernheim.net> wrote:
> On 27.09.2010, at 15:44, Uwe Dauernheim wrote:
>
>> Hej,
>>
>> is it possible to have lambas in functions like lists:foldl/3 in ifene 
syntax without '{...}'? Like the following:
>>
>> run = fn()
>>  fun = lists.fold(fn(E, Acc)
>>    io.format("~p~n", [Expr]), [], [])
>>
>> # or
>>
>> run = fn()
>>  fun = lists.fold(fn(E, Acc)
>>    io.format("~p~n", [Expr]),
>>  [], [])
>>
>> # or
>>
>> run = fn()
>>  fun = fn(E, Acc)
>>    io.format("~p~n", [Expr])
>>  lists.fold(fun:2, [], [])
>>
>> Neither of them work for me, so I guess I haven’t declared the syntax 
correctly. I have some clues about the first two tries, but the last 
should work, or?
>>
>> /Uwe
>
> Ok, I was too quick and saw the error on the last example. It has to be:
>
> run = fn()
>  fun = fn(E, Acc)
>    io.format("~p~n", [Expr])
>  lists.fold(fn fun:2, [], [])
>
> (...Besides they would all fail because Expr is not defined)
>

I pushed the changes to make it work:

@public
run = fn ()
    Result = lists.map(fn (A)
        A + 1
    , 1..10)

    fio.println(Result)

I never used it because I tend to define the lambda outside like this:

@public
run = fn ()
    Fun = fn (A)
        A + 1

    Result = lists.map(Fun , 1..10)

    fio.println(Result)

but it's nice to have it

compiling and running:

mariano@ganesha:~$ fnc testmap.ifn
Compiling testmap.ifn
mariano@ganesha:~$ fnc -r testmap run
[2, 3, 4, 5, 6, 7, 8, 9, 10, 11]

Re: [efene] Lambdas in functions like lists:foldl/3 in ifene without '{...}'

From:
Uwe Dauernheim
Date:
2010-09-28 @ 11:44
> On Mon, Sep 27, 2010 at 10:48 AM, Uwe Dauernheim <uwe@dauernheim.net> wrote:
>> On 27.09.2010, at 15:44, Uwe Dauernheim wrote:
>> 
>>> Hej,
>>> 
>>> is it possible to have lambas in functions like lists:foldl/3 in ifene
syntax without '{...}'? Like the following:
>>> 
>>> run = fn()
>>>  fun = lists.fold(fn(E, Acc)
>>>    io.format("~p~n", [Expr]), [], [])
>>> 
>>> # or
>>> 
>>> run = fn()
>>>  fun = lists.fold(fn(E, Acc)
>>>    io.format("~p~n", [Expr]),
>>>  [], [])
>>> 
>>> # or
>>> 
>>> run = fn()
>>>  fun = fn(E, Acc)
>>>    io.format("~p~n", [Expr])
>>>  lists.fold(fun:2, [], [])
>>> 
>>> Neither of them work for me, so I guess I haven’t declared the syntax 
correctly. I have some clues about the first two tries, but the last 
should work, or?
>>> 
>>> /Uwe
>> 
>> Ok, I was too quick and saw the error on the last example. It has to be:
>> 
>> run = fn()
>>  fun = fn(E, Acc)
>>    io.format("~p~n", [Expr])
>>  lists.fold(fn fun:2, [], [])
>> 
>> (...Besides they would all fail because Expr is not defined)
>> 
> 
> I pushed the changes to make it work:
> 
> @public
> run = fn ()
>    Result = lists.map(fn (A)
>        A + 1
>    , 1..10)
> 
>    fio.println(Result)
> 
> I never used it because I tend to define the lambda outside like this:
> 
> @public
> run = fn ()
>    Fun = fn (A)
>        A + 1
> 
>    Result = lists.map(Fun , 1..10)
> 
>    fio.println(Result)
> 
> but it's nice to have it
> 
> compiling and running:
> 
> mariano@ganesha:~$ fnc testmap.ifn
> Compiling testmap.ifn
> mariano@ganesha:~$ fnc -r testmap run
> [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]

I can confirm that the patch works. Very nice work!

/Uwe