udem-dlteam / pnut

🥜 A Self-Compiling C Transpiler Targeting Human-Readable POSIX Shell
https://pnut.sh
BSD 2-Clause "Simplified" License
425 stars 14 forks source link

Don't show the character constants header when there aren't any #35

Closed laurenthuberdeau closed 5 months ago

laurenthuberdeau commented 5 months ago

Context

The # Character constants header appear unconditionally. Now that we're trying to reduce the size of the generated shell code and make it nicer, we want it to appear only if character constants are used.

Example where it appears

: $((n = 0))
_main() {
  save_vars $n
  n=0
  _fib n 15
  _exit __ $n
  unsave_vars $1 n
}

# Character constants
# Runtime library
readonly _NULL=0
readonly _EOF=-1

...