Cyrille Duret
2014-04-30 07:04:36 UTC
hello,
I have good interest in postfix concatenative languages for some years now,
I discover the postfix notation with forth and saw the beauty of joy and
now I try to experiment the benefit of a concatenative language for
distributed application, user interface ( I am thinking of a visual touch
based programming environment a bit like hopscotch
https://www.gethopscotch.com/) , etc..
My language of prototyping is javascript and my language of choice for
implementation is ATS2 (http://www.ats-lang.org/)
I have already done a conventional implementation of a very basic language
here https://github.com/cduret/stk.js , but I want to go further.
At the time I read this paper (
http://mitarbeiter.hs-heilbronn.de/~herzberg/Publications/ICSOFT.2009.pdf),
I saw the power and simplicity of a concatenative language based on a
rewriting system.
So I began my implementation of a basic rewrite system :
The words can be defined with pattern matching as follow :
x dup => x x.
x y swap => y x.
[x_] call => x_.
...
Rewriting system is powerful and can compute symbolic expression as well
but the explosion of rewriting steps can lead to slow execution time.
That's why I try to think about a compiler that would transform the
rule-based program into a stack oriented bytecode.
My first problem is to find a way of rewriting a rule with named parameters
into a point-free word (in a forth or factor meaning).
How I could compile the rule :
a b toto => a a * 3 b * +.
into
toto => 3 * swap dup * +.
I am looking for such an algorithm if you have some advices..
thank you very much ;-)
I have good interest in postfix concatenative languages for some years now,
I discover the postfix notation with forth and saw the beauty of joy and
now I try to experiment the benefit of a concatenative language for
distributed application, user interface ( I am thinking of a visual touch
based programming environment a bit like hopscotch
https://www.gethopscotch.com/) , etc..
My language of prototyping is javascript and my language of choice for
implementation is ATS2 (http://www.ats-lang.org/)
I have already done a conventional implementation of a very basic language
here https://github.com/cduret/stk.js , but I want to go further.
At the time I read this paper (
http://mitarbeiter.hs-heilbronn.de/~herzberg/Publications/ICSOFT.2009.pdf),
I saw the power and simplicity of a concatenative language based on a
rewriting system.
So I began my implementation of a basic rewrite system :
The words can be defined with pattern matching as follow :
x dup => x x.
x y swap => y x.
[x_] call => x_.
...
Rewriting system is powerful and can compute symbolic expression as well
but the explosion of rewriting steps can lead to slow execution time.
That's why I try to think about a compiler that would transform the
rule-based program into a stack oriented bytecode.
My first problem is to find a way of rewriting a rule with named parameters
into a point-free word (in a forth or factor meaning).
How I could compile the rule :
a b toto => a a * 3 b * +.
into
toto => 3 * swap dup * +.
I am looking for such an algorithm if you have some advices..
thank you very much ;-)