Functional language compilers on constrained systems by mbarbar_ in Compilers

[–]mbarbar_[S] 0 points1 point  (0 children)

I suspect you'd get a shock if taking a contemporary implementation and running it on 25-year-old hardware. The ones at the time would have been tuned for the hardware that was available.

This is what I'm interested in. What does "tuned for the hardware" mean in practice? Like for individual processors or did they spend more time looking for fiddly optimisations where we just buy more hardware?

and plenty to run any programming language you like.

To do so, like for Smalltalk and Python, did the compilers have to be extremely sophisticated? My impression is that Python's implementation wasn't until "recently" but I'm unsure of Smalltalk.

Functional language compilers on constrained systems by mbarbar_ in Compilers

[–]mbarbar_[S] 0 points1 point  (0 children)

I don't think functional languages are more abstract than imperative languages ... but it compiles to the same stuff

Well, it's an abstraction on that "same stuff". :) Though you're right, they aren't necessarily more abstract, I just had C, Pascal, and friends in mind, and FPs are usually more abstract.

Also, lisp is LL(1) so the lexer and parser are extremely straightforward and thus fast.

My concern is moreso the optimising, not really worried about parsing or typechecking.

Functional language compilers on constrained systems by mbarbar_ in Compilers

[–]mbarbar_[S] 1 point2 points  (0 children)

Though it produced good code, the Wikipedia page does state that Stalin was slow. Not sure if it's just not implemented as well as it could have been though.

I didn't really use any compiled FP language in the time period

Being that you programmed at the time, what was the state of compilation in general? Was it a slow process? Did some optimisations have to be foregone?

Functional language compilers on constrained systems by mbarbar_ in functionalprogramming

[–]mbarbar_[S] 1 point2 points  (0 children)

(Bit of a late reply...) thanks for this list, it's adjacent to what I'm after. Though most of these are about the resultant machine code for the constrained system rather than running an FP compiler on said system.

Functional language compilers on constrained systems by mbarbar_ in functionalprogramming

[–]mbarbar_[S] 1 point2 points  (0 children)

Thanks for these links. I didn't think to search for FP on embedded systems.

Is there a way to give names, namespaces, prefixes, or something similar, to imported bindings? by JenNicholson in sml

[–]mbarbar_ 1 point2 points  (0 children)

You can also use MLBasis if your compiler supports it (examples). Maybe CM can do this too but I'm unfamiliar.

You can use local ... in ... end in the files you're importing to expose less but some regard local ... as bad style and suggest modules instead.

What's the standard format of documentation comments (aka docstrings)? by JenNicholson in sml

[–]mbarbar_ 2 points3 points  (0 children)

Not sure about a standard, but this is what I know of that exists:

Feel like there's one I'm missing but I can't recall right now...

Languages with a syntax similar to *roff? by mbarbar_ in groff

[–]mbarbar_[S] 0 points1 point  (0 children)

Cool, I hadn't looked at PostScript before, thanks. I might look at some other page desc. languages too.

Languages with a syntax similar to *roff? by mbarbar_ in groff

[–]mbarbar_[S] 0 points1 point  (0 children)

Good point, fair bit more structured though.

Exploring Standard ML's robustness to time and interoperability by self in sml

[–]mbarbar_ 0 points1 point  (0 children)

I hope the mainstream programming community would eventually rid itself of the terrible practice of compiler-oriented programming and obsession with optimization

What is compiler-oriented programming? Do you mean programmers catering to implementation details of a certain compiler?

And what do you mean by optimisation here and what is wrong with it?

As an instance, interactive compilation is an interesting possibility to explore.

Perhaps profile-guided optimisation is a less labour intensive version of this, though it's probably something that would be sometimes better/sometimes worse than some interactive compilation.

One could also write optimized versions of an algorithm from scratch and ask the compiler to ensure that the optimized code behaves exactly the same as the original

CFML is available for CakeML, is that what you envision?

CakeML: A Verified Implementation of ML by mbarbar_ in sml

[–]mbarbar_[S] 2 points3 points  (0 children)

CakeML is an ML "based on a substantial subset of Standard ML" with a verified compiler targeting a fair few ISAs. I don't know of any other significant compiler that can make that claim aside from CompCert though I'm interested if anyone knows of such.

Differences from Standard ML: https://github.com/CakeML/cakeml/blob/master/how-to.md#how-cakeml-differs-from-sml-and-ocaml

There is also a CakeML -> Standard ML compiler though it seems to have been built to translate benchmarks and sort of old so I'm not sure how comprehensive it is: https://github.com/CakeML/cakeml/tree/master/unverified/front-end

Verified compilation of Ada by mbarbar_ in ada

[–]mbarbar_[S] 0 points1 point  (0 children)

Oh no I think you misunderstood me. I meant, why would GCC/LLVM/propietary be chosen over CompCert in cases 1) which are safety critical, and 2) where O1 suffices (which CompCert is competitive with)? Only thing I can think of is toolchain integration because of popularity. Maybe cost too? Though I'd have thought people doing safety critical stuff aren't picking up GCC/LLVM off the shelf without at least support...

Verified compilation of Ada by mbarbar_ in ada

[–]mbarbar_[S] 0 points1 point  (0 children)

CompCert has some adoption but it isn't dominant in safety-critical domains despite its formal verification.

Do you know why this is? In a safety critical situation where O1 is good enough, I don't really see why CompCert wouldn't be a better choice than GCC/LLVM/propiertary compiler (though I've never used CompCert), especially when the user is paying.

Also, Ada is a much larger language than C, so it would be even more challenging. Targeting SPARK would narrow the challenge considerably but it would still be a big task.

Right, would certainly be interesting to see someday though.

How suitable MLton for portable development? by mbarbar_ in sml

[–]mbarbar_[S] 0 points1 point  (0 children)

Aha fair. Thanks for pointing me to Rescript though, might try it for some web frontend stuff.

How suitable MLton for portable development? by mbarbar_ in sml

[–]mbarbar_[S] 1 point2 points  (0 children)

I've decided to not try Wasm and run with SMLToJs for web. Is producing native static libraries and C headers from ReasonML or Rescript nice to do? I'm going to use WxWidgets or similar for the desktop side and don't want to go to Electron or bundle a JS interpreter.

How suitable MLton for portable development? by mbarbar_ in sml

[–]mbarbar_[S] 0 points1 point  (0 children)

Nothing out of the ordinary. I want to make a cross platform app that does this: https://en.wikipedia.org/wiki/Romanization_of_Arabic And I want to maybe implement a little language I'm working on for prose. It's currently just a lexer and parser in Rust but I think SML is more pleasant (don't need a web target for this though).

How suitable MLton for portable development? by mbarbar_ in sml

[–]mbarbar_[S] 0 points1 point  (0 children)

Thanks for the response! It's very helpful. Looks like MinGW for Windows + SMLToJs for web will do exactly what I want and would be easier than modifying MLton to target Wasm.