Hacker News new | past | comments | ask | show | jobs | submit | azdavis's comments login

Might this help? I wrote it: https://azdavis.net/posts/define-pl-01/


SML pops up now and again on HN, which is always nice to see. I wrote a language server for SML in an attempt to improve the tooling situation around the language: https://azdavis.net/posts/millet/

The main motivator for why I did this is because we use SML as a teaching language at my university and students always seem to struggle with the error messages and tooling from the compiler.


I made a language server for SML with a focus on attempting to provide good error messages: https://azdavis.net/posts/millet/


it's wonderful and thank you :)


Glad to see new languages designed around having good support for IDEs. matklad (rust analyzer) and I wrote a bit about this:

- https://matklad.github.io/2023/08/01/on-modularity-of-lexica...

- https://azdavis.net/posts/pl-idea-tooling/

I think pure functions, sum/product types, and pattern matching are generally accepted as an excellent way to model and manipulate pure data. I wonder what the team’s thoughts are about handling less pure things like asynchrony and I/O, as well as more interesting control flow like exceptions/panicking, coroutines, generators, iterators, etc.


For the IDE use case, I made a language server for SML: https://azdavis.net/posts/millet/


For editor support for Standard ML you can try Millet, a language server. https://azdavis.net/posts/millet/

There’s also https://smlhelp.github.io/book/ which is mostly put together by current/past CMU students.

Note: I made Millet.


I’ve been working on a language server for Standard ML called Millet: https://azdavis.net/posts/millet/

There was some past discussion about it on HN: https://news.ycombinator.com/item?id=32512715

For my part, I think it’s unfortunate that virtually no mainstream language has a formal semantics in the style of SML’s Definition. I wrote a bit about formal programming language semantics in a series of posts: https://azdavis.net/posts/define-pl-01/


I've had a quick look over your posts, and I will look over the more carefully as a refresher on these kinds of things (I have looked at Hoare logic which this resembles, and a couple of other related things). The problem is to me, the formal semantics aren't actually very different from what you would write in English, and the real problem, and this is never addressed, how do I use this (which includes: how do I manipulate these things symbolically to some useful end)? The reason I don't get more deeply stuck into these formal semantics is because they seem to have no way for me to actually do anything useful with them. This lack of a 'bridge' is a huge problem to me because I can't justify learning that which appears of no use.

Any comments appreciated, and don't be put off by the negative tone of this, it's just frustration.


The biggest reason why you'd want a formal semantics for your PL, as opposed to just a "human" language specification, is so that you can do proofs about the formal semantics. You can prove your PL, as defined, satisfies certain "safety" properties. And the point of doing these proofs is is to check that the definition of the PL "makes sense".

PLs that don't have a formal semantics (aka, most mainstream PLs) are more likely to be in situations where implementors realize, after the standard has been written, that e.g. some of the PL's features interact in a way that doesn't make sense, such as this example with C++ coroutines and lambdas: https://news.ycombinator.com/item?id=33084431

Two of the most common safety properties of interest are progress and preservation. (I touched on this in the last above linked post near the bottom.) At a high level:

1. Progress states that if you have a program that type-checks, then either that program is "done" or it can continue evaluating.

2. Preservation states that if you have a program that type-checks and that can continue evaluating, then as it continues to evaluate, it continues to type-check.

Note that the conclusion of preservation "feeds back" into progress: the program type-checks. And vice versa: progress may state as its conclusion that the program can continue evaluating, which then lets you apply preservation. This means you can keep applying the progress and preservation theorems in a "loop" until the program is done evaluating.

For each of the 4 posts in my series about formal semantics, I duly translated the rules presented in the blog post into Lean code, and then proved that the rules do satisfy the safety properties. For example, for the first post linked above:

- The syntax of the language: https://github.com/azdavis/hatsugen/blob/part-01/src/syntax....

- The static semantics (the "typechecker"): https://github.com/azdavis/hatsugen/blob/part-01/src/statics...

- The dynamic semantics (the "runtime"): https://github.com/azdavis/hatsugen/blob/part-01/src/dynamic...

- The proofs of safety: https://github.com/azdavis/hatsugen/blob/part-01/src/safety....


I have a background in formal methods and PLs, and never used it. I understand the supposed benefits but IME they never got used.

Clearly you have used it, so I'll take time looking over your stuff (though I don't know lean).

I appreciate you taking the time to write a comprehensive answer, as I said, I'll try to do it justice!


Hoping Millet doesn't mean anything offensive in any language… Studio Ghibli had this problem mildly with their film "Laputa" ("la puta" = "the whore" in Spanish).


That name actually was an homage to Gulliver's Travels, where it was intentional.


ojalá que laputa no los haya embarazado!




It’s a group of mostly current/former CMU 15-150 TAs working on various SML tools, like:

https://github.com/brandonspark/mulligan

https://github.com/T-Brick/molasses

https://github.com/shwestrick/parse-sml


Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: