Sujet : How compile a DSL, does it need Types? (Re: Side Note, Why not DSLs?)
De : janburse (at) *nospam* fastmail.fm (Mild Shock)
Groupes : sci.mathDate : 03. Jan 2025, 22:52:17
Autres entêtes
Message-ID : <vl9m6h$25tsp$3@solani.org>
References : 1 2 3
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/8685Mild Shock schrieb:
The original post was:
Subject: Chicken and egg, with curry?
Partial and tentative:
```
Functional = Closures/applications, Reduction/canonicity
/ |
Logical | = Predicates/queries, Resolution/subsumption
\ |
Imperative = Procedures/invocations, Execution/...
```
And there are two views of that triangle: Logical is the top of the *ideal* such triangle, along the lines of a universe with Prop on top, which we can reason with; Imperative is the bottom of a *concrete* such triangle, the bootstrap as well as the final point of application of any concrete system.
And Logical is the constructive (structural) type-theory founding the Functional, where Functional exists for expressivity and modularity (what else?), plus can be compiled back/down to machine language...
Right?
-Julio
Chris M. Thomasson schrieb:
On 1/3/2025 1:20 PM, Mild Shock wrote:
Hi,
>
Just a side note, don't let you get distracted.
A side node about the chicken/egg problem, i.e.
without the curry:
[...]
>
What about this... The universe was never created simply because it was always there. It will always be there, and never cease to exist? ;^)
>