Live data from Hacker News

Pnut: A C to POSIX shell compiler you can trust

pnut.sh

61–70 of 124 posts

Re: Pnut: A C to POSIX shell compiler you can trust

#61
post #56

Earlier quoted context omitted.

With C, you have the whole toolbox and the toolbox factory.

Both the tweezers and the bit flipping magnet .. and who would want anything more?

Yeah — C would be ok as a build system language if it was easy to: invoke & manage subprocesses; build & manage dynamic dependency graphs; and, easily work with file metadata.

Or... work with me: Make does that, well enough.

Re: Pnut: A C to POSIX shell compiler you can trust

#63

Just to be clear, the input must be written in a subset of C, because many constructs are not recognized, like unsigned types, static variables, [] arrays, etc. Is there a plan to remove such limitations?

These are restrictions of the target language and there isn't much pnut can do about this.

Surely unsigned (aka modulo) arithmetic and arrays are expressible in shell script?

edit: For reference, someone's take on building out better bash-like array functionality in posix shell: https://github.com/friendly-bits/POSIX-arrays (there's only very rudimentary array support built-in to posix sh, basically working with stuff in $@ using set -- arg1 arg2..)

Re: Pnut: A C to POSIX shell compiler you can trust

#64

I love things like these because they shake our perception of normal loose. And who said our perception of normal doesn't deserve a good shake? A C to shell compiler might seem impractical, but you know what is even more impractical? Having a separate language for a build system. And yet, here we are. Using Shell, Make or CMake to build a C program is only acceptable because is has always been so. It's a "perceived n…

> but you know what is even more impractical? Having a separate language for a build system.

I disagree. For a very simple example it really makes life easier to not have to care about quoting filenames in build systems and just list a.c b.cpp etc., while you really want strings to be quoted in normal programming languages. Build systems that tried to be based on syntax of existing PLs (for instance Meson, QBS) are a real PITA for me when compared to CMake due to a lot of such affordances.

Re: Pnut: A C to POSIX shell compiler you can trust

#69
post #47
post #44

Earlier quoted context omitted.

I cant run cosmolibc on Android, for example. Then again this converter is somewhat limited and didn't accept any of the IOCCC code I gave it.

> I cant run cosmolibc on Android, for example. You can: https://justine.lol/cosmo3/ > After nearly one year of development, I'm pleased to announce our version 3.0 release of the Cosmopolitan library. [...] we invented a new linker that lets you build fat binaries which can run on these platforms: AMD ... ARM64 https://github.com/jart/cosmopolitan/releases/tag/3.5.3 > This release fixes Android support. You can now…

Can you run it on RISCV Android?!
Post reply on HN