[MLton] Adding new primitive functions to MLton
Morten Olsen Lysgaard <[email protected]> Mon, 26 Oct 2020 23:02:57 +0100
| Newsgroups | gmane.comp.lang.ml.mlton.devel |
|---|---|
| Message-ID | <CAOujwNG=cMbpMxUrwBtxkFSuoOqXDKM2PAKHpHViTCOwrdWNCA@mail.gmail.com> |
--===============5012593778111485717== Content-Type: multipart/alternative; boundary="000000000000f1c73e05b29a1930" --000000000000f1c73e05b29a1930 Content-Type: text/plain; charset="UTF-8" Hi, I am doing some exploratory work on a synchronous programming language. This is a follow up of my previous email about using an empty basis. In that work I have found MLton to have a very good fit as a frontend. Like other synchronous languages, eg. lucid synchrone, lustre, there are primitive time operators. These are: pre : forall a. a -> a when : forall a. a -> Bool -> a fby : forall a. a -> a -> a These functions will have a special meaning for the runtime of my language, and are thus not possible to implement as library functions. I would like them to be built into the compiler. My first goal is to be able to write code using the functions, and have them go all the way to core-ml. Not really having the function do anything, just lexing, parsing, type checking. I started hacking in one end, but I quickly realized that I need to understand more about the architecture and design choices that have been made for MLton before I add my functions. I would be very happy for pointers to the relevant places in the MLton source for my ideas. * My thinking is that the functions may not need to be specially handled during lexing and parsing, because they look like any other function calls for the lexer/parser. Is this correct? * They need to have a "hard-coded" type in the type checker. How to best achieve this? * How does MLton handle primitive functions like this? Does it use it's own full fledged expression node for each primitive, is there a special abstraction in the AST for primitives, or is it using some other solution? Regards, Morten --000000000000f1c73e05b29a1930 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div>Hi, I am doing some exploratory work on a synchronous= programming language. This is a follow up of my previous email about using= an empty basis.<br></div><div>In that work I have found MLton to have a ve= ry good fit as a frontend.</div><div><br></div><div>Like other synchronous = languages, eg. lucid synchrone, lustre, there are primitive time operators.= These are:</div><div><br></div><div>pre : forall a. a -> a</div><div>wh= en : forall a. a -> Bool -> a</div><div>fby : forall a. a -> a -&g= t; a</div><div><br></div><div>These functions will have a special meaning f= or the runtime of my language, and are thus not possible to implement as li= brary functions. I would like them to be built into the compiler.<br></div>= <div><br></div><div>My first goal is to be able to write code using the fun= ctions, and have them go all the way to core-ml. Not really having the func= tion do anything, just lexing, parsing, type checking.</div><div><br></div>= <div>I started hacking in one end, but I quickly realized that I need to un= derstand more about the architecture and design choices that have been made= for MLton before I add my functions.<br></div><div>I would be very happy f= or pointers to the relevant places in the MLton source for my ideas.</div><= div><br></div><div>* My thinking is that the functions may not need to be s= pecially handled during lexing and parsing, because they look like any othe= r function calls for the lexer/parser. Is this correct?<br></div><div>* The= y need to have a "hard-coded" type in the type checker. How to be= st achieve this?</div><div>* How does MLton handle primitive functions like= this? Does it use it's own full fledged expression node for each primi= tive, is there a special abstraction in the AST for primitives, or is it us= ing some other solution?</div><div><br></div><div>Regards, Morten<br></div>= </div> --000000000000f1c73e05b29a1930-- --===============5012593778111485717== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============5012593778111485717== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ MLton-devel mailing list [email protected]; [email protected] https://lists.sourceforge.net/lists/listinfo/mlton-devel --===============5012593778111485717==--