S2CC(1)

πŸ“¦ version 2012.10.14, in ubuntu jammy

πŸ’– S2CC(1) β€” the Scheme-to-C compiler bestie πŸ’–

ok so real talk: this is a General Commands Manual page, section 1, and the command is s2cc. that's it. that's the girl. let's get into it πŸŽ€


✨ NAME ✨

s2cc β€” Scheme to C compiler πŸ¦‹


✨ SYNTAX ✨

s2cc [ option ] ... file ...

✨ DESCRIPTION ✨

okay so the s2cc command β€” she used to go by scc, glow-up era β€” invokes a Scheme compiler. and what does she accept? the language defined in the essential portions of the Revised4 Report on the Algorithmic Language Scheme, with minor constraints and some additions. we're keeping it essential, we're keeping it cute.

the compiler produces C source files, which then get compiled using the system's C compiler to produce conventional .o and a.out files. so it's like a little relay race πŸƒβ€β™€οΈπŸ’¨

and the C code produced by this compiler? she's flexible. it may be intermixed with other C code, or code written in other languages. cross-language collab, we love to see it. πŸ”₯


✨ OPTIONS ✨

these options are accepted by s2cc. any other options will be assumed to be options of the system's C compiler, and they'll be passed along to it when it gets invoked. she's forwarding your mail, bestie πŸ’Œ

  • -cc C compiler β€” compile the Scheme compiler produced C code with C compiler. if this flag is not supplied, then the C compiler cc will be used. (default queen behavior πŸ‘‘)
  • -C β€” compile the Scheme programs found in the files source.sc and leave the resulting code in source.c files. no further operations are performed. that's it, that's the whole job, periodt.
  • -I directory β€” specifies a directory to be searched by include for source files. πŸ—‚οΈ
  • -f symbol value β€” define the compile-time constant symbol to value. this is equivalent to the construct (define-constant symbol value) appearing in the Scheme source. same energy, different font. ✨
  • -i β€” combine the source and object files into a Scheme interpreter. the module name for each Scheme source file is automatically determined. module names for previously compiled modules must be specified using the -m option. iykyk 🧚
  • -m module-name β€” specifies the name of a previously compiled module. note that the Scheme compiler will downshift the alphabetic characters in the module-name. modules are initialized in the order that the -m flags appear. so order matters, bestie, don't be chaotic. πŸ’…
  • -Ob β€” optimize code by omitting bounds checks on vectors and strings. πŸ”₯
  • -Og β€” optimize code by omitting stack trace-back code.
  • -On β€” optimize code by assuming that all numbers are fixed point. all numbers. no cap.
  • -Ot β€” optimize code by omitting type error checks.
  • -pg β€” produce profiled code for run-time measurement using gprof(1). the profiled library is used in lieu of the standard Scheme library. πŸ“Š
  • -scgc statflag β€” enables garbage collection statistics. if set to 1, then garbage collection statistics will be printed. the default is 0, that will result in no statistics. (the gc is quiet, she's mysterious 🌸)
  • -sch heap β€” specifies the compiler's initial heap size in megabytes. the default is system dependent. πŸ€·β€β™€οΈ
  • -scl percent β€” specifies the percent of the heap allocated after a generational garbage collection that will force a full collection. the default is 40.
  • -scmh heap β€” specifies the compiler's maximum heap size in megabytes. the default is five times the initial size of the heap. math girlies rise 🫢
  • -LIBDIR directory β€” specifies a directory containing the files: predef.sc, objects.h, libs2c.a, and optionally libs2c_p.a. the whole squad, assembled. πŸ’–
  • -log β€” logs information internal to the compiler to the C source file produced by the compiler. each type of information is controlled by a flag: -source, -macro, -expand, -closed, -transform, -lambda, -tree, -lap, -peep. the flag -log is equivalent to specifying the flags: -source, -macro, -expand, -closed, -transform, -lambda, -tree. (so -log is the group chat, and the others are the individual DMs 😭)

✨ ENVIRONMENT VARIABLES ✨

the items controlled by -sc.. flags can also be controlled by environment variables. and if both the flag and the environment variable are provided, then the flag's value will be used. flag wins, no debate, main character energy. πŸ‘‘

  • SCGCINFO β€” controls the reporting of garbage collection statistics to the standard error file. if set to 1, then garbage collection statistics will be printed. the default setting is 0 that will not print the statistics.
  • SCHEAP β€” specifies the initial size of the heap in megabytes. the default heap size is system dependent.
  • SCLIMIT β€” specifies the percent of the heap allocated after a generational garbage collection that will force a full collection. the default is 40.
  • SCMAXHEAP β€” specifies the maximum size of the heap in megabytes.

✨ INPUT FILES ✨

following the command options come one or more file names. lineup, girlies πŸ’…

  • name.sc β€” Scheme source. Scheme source files will be compiled into C files with the name name.c.
  • name.c β€” C source.
  • name.s β€” Assembly language source.
  • name.o β€” Object file which may have been generated by any compiler.
  • name.a β€” Object file archive which may have been generated by any compiler.

✨ DIAGNOSTICS ✨

the diagnostic messages produced by the compiler are printed on the standard error file. so when she's yelling, she's yelling over there. πŸ“’πŸ˜­


✨ FILES ✨

  • /.../schemetoc/... β€” source and documentation
  • /.../libs2c.a β€” library
  • /.../libs2c_p.a β€” profiled library (optional)
  • /.../s2cc β€” shell script
  • /.../s2ccomp β€” compiler
  • /.../predef.sc β€” predefined functions
  • /.../objects.h β€” definitions "#include'd" in the C code
  • SC-TO-C.c β€” temporary C source file
  • source.S2C β€” temporary C source file
  • SC-TO-C.o β€” temporary object file

✨ LIMITATIONS ✨

okay this part is important so lock in πŸ”’

when the compiler is able to identify every call to a procedure, it is able to generate it "in-line", and perform tail calls by using "goto". this analysis covers most loops, conditional expressions, and finite state machines. iconic, honestly.

for non-tail recursive calls, the code generated by the compiler uses the standard C mechanisms for procedure call and return. this therefore requires that each top-level Scheme procedure, and any Scheme procedure which has more than one call which is not tail-recursive, be compiled into its own C procedure. calls to such procedures will be tail-recursive if and only if the host C compiler optimizes tail-recursion. so it's giving... it depends on your C compiler, bestie. no promises. 😭


✨ SEE ALSO ✨

  • Harold Abelson and Gerald Jay Sussman with Julie Sussman, Structure and Interpretation of Computer Programs, The MIT Press. πŸ¦‹
  • William Clinger and Jonathan Rees (Editors), Revised4 Report on the Algorithmic Language Scheme, LISP Pointers, Volume IV, Number 3, July-September 1991. PostScript for this file is included in the software distribution.
  • Jerry D. Smith, An Introduction to Scheme, Prentice Hall, Inc. Chapter notes for using this text with Scheme->C are included in the software distribution.
  • R. Kent Dybvig, The SCHEME Programming Language, Prentice Hall, Inc.
  • Daniel P. Friedman and Matthias Felleisen, The Little LISPer, MIT Press.
  • Joel F. Bartlett, Scheme->C a Portable Scheme-to-C Compiler, WRL Research Report 89/1.
  • Additional documentation is included in the software distribution.
  • s2ci(1)

✨ QUESTIONS, COMMENTS, AND COMPLAINTS ✨

http://alioth.debian.org/projects/scheme2c/


and that's the whole page, bestie πŸŽ€ every single flag, every default, every file path, untouched, unbothered, in her original order. slay.

this page is filed under local, section S2CC(1) β€” so when you're searching the manual, that's where she lives. mwah πŸ’‹βœ¨πŸŒˆ

πŸ“¦ where this page comes from