Sujet : How compile a DSL, does it need Types? (Re: Side Note, Why not DSLs? (Re: Chicken and egg, with curry?)
De : janburse (at) *nospam* fastmail.fm (Mild Shock)
Groupes : comp.lang.prologDate : 03. Jan 2025, 22:50:11
Autres entêtes
Message-ID : <vl9m2j$25tsp$2@solani.org>
References : 1 2 3 4 5
User-Agent : Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 SeaMonkey/2.53.19
Hi,
Well you don't need always types. JavaScript
has also no types. And there is a trend to
have gradual types. Make them kind of optional
and arive at TypeScript. If I am not mistaken,
you can omit Types in TypeScript here and then,
and simply get JavaScript. You can still prove things
about, just assume that you have an "any" type. What
other benefit do you think have types? For example
the Floyd Warshall algorithm in DSL works without
any declared types although it has a manifest type
of matrice somehow. Also many Program transformations,
such as the compilation of the DSL doesn't need types.
Here you see the compilation of the DSL,
I just turned the helper predicate into expansion rules:
goal_expansion(let V = E,
let2(E,V)) :- var(V), !.
goal_expansion(let D[R,C] = E,
(let2(E,V),
arg(R, D, H),
nb_setarg(C, H, V))).
goal_expansion(let2(V, V), true) :- var(V), !.
goal_expansion(let2(D[R,C], V),
(arg(R, D, H),
arg(C, H, V))) :- !.
goal_expansion(let2(E+F, R),
(let2(E, V),
let2(F, W),
R is V+W)) :- !.
goal_expansion(let2(V, V), true).
goal_expansion(if E > F,
(let2(E, V),
let2(F, W),
V > W)).
Sadly I don't have yet goal expansion in Dogelog Player. But
SWI-Prolog has it. I might introduce it in the next release
provided I find an ultra simple solution. Or an inline directive.
Bye
The SWI-Prolog thread was this:
https://swi-prolog.discourse.group/t/floyd-warshall-algorithm-in-prolog/8685Julio Di Egidio schrieb:
On 03/01/2025 22:12, Mild Shock wrote:
Ok I see its repeating my posts to comp.lang.prolog,
because the sci.logic post has a shitty header!
>
Fuck Fuck Fuck Julio what are you doing Fuck Fuck Fuck
I set the follow-up to comp.lang.prolog, the specifics of Prolog are not relevant to the general discussion.
Pity you don't know how Usenet works. And that e.g. one can simply delete locally the spurious messages, so it's no big deal really...
-Julio