logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

s2cc - Scheme to C compiler

Description

       The  s2cc  command (previously known as scc) invokes a Scheme compiler which accepts the language defined
       in the essential portions of Revised4ReportontheAlgorithmicLanguageScheme, with  minor  constraints
       and  some  additions.   The compiler produces C source files which are then compiled using the system's C
       compiler to produce conventional .o and a.out files.  The  C  code  produced  by  this  compiler  may  be
       intermixed with other C code or code written in other languages.

Diagnostics

       The disgnostic messages produced by the compiler are printed on the standard error file.

Environment Variables

       The  items  controlled  by -sc.. flags can also be controlled by environment variables.  If both the flag
       and the environment variable are provided, then the flag's value will be used.

       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.

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

Input Files

       Following the command options come one or more file names.

       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.

Limitations

       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.  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.

Name

       s2cc - Scheme to C compiler

Options

       These  options  are  accepted  by  s2cc.   Other  options will be assumed to be options of the system's C
       compiler and they will be passed to it when it is invoked.

       -ccCcompiler   Compile the Scheme compiler produced C code with Ccompiler.   If  this  flag  is  not
                         supplied, then the C compiler cc will be used.

       -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.

       -Idirectory     Specifies a directory to be searched by include for source files.

       -fsymbolvalue Define the compile-time constant symbol to value.  This is equivalent to the  construct
                         (define-constant symbolvalue) appearing in the Scheme source.

       -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.

       -mmodule-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.

       -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.

       -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.

       -scgcstatflag  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.

       -schheap        Specifies  the  compiler's  initial  heap  size  in  megabytes.   The default is system
                         dependent.

       -sclpercent      Specifies the percent of the heap allocated after  a  generational  garbage  collection
                         that will force a full collection.  The default is 40.

       -scmhheap       Specifies the compiler's maximum heap size in megabytes.  The default is five times the
                         initial size of the heap.

       -LIBDIRdirectory
                         Specifies  a  directory  containing  the  files:  predef.sc,  objects.h,  libs2c.a, and
                         optionally libs2c_p.a.

       -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.

Questions, Comments, And Complaints

See Also

       Harold Abelson and Gerald Jay Sussman with  Julie  Sussman,  StructureandInterpretationofComputerPrograms, The MIT Press.

       William  Clinger  and  Jonathan  Rees (Editors), Revised4ReportontheAlgorithmicLanguageScheme, LISP
       Pointers, Volume IV, Number 3, July-September 1991.  PostScript for this file is included in the software
       distribution.

       Jerry D. Smith, AnIntroductiontoScheme, Prentice Hall, Inc.  Chapter notes for using  this  text  with
       Scheme->C are included in the software distribution.

       R. Kent Dybvig, TheSCHEMEProgrammingLanguage, Prentice Hall, Inc.

       Daniel P. Friedman and Matthias Felleisen, TheLittleLISPer, MIT Press.

       Joel F. Bartlett, Scheme->CaPortableScheme-to-CCompiler, WRL Research Report 89/1.

       Additional documentation is included in the software distribution.

       s2ci(1)

Syntax

s2cc [ option ] ... file ...

See Also