NAME
scalac − Compiler for the Scala 2 language
SYNOPSIS
scalac [ <options> ] <source files>
PARAMETERS
<options>
Command line options. See OPTIONS below.
<source files>
One or more source files to be compiled (such as MyClass.scala).
OPTIONS
The compiler has a set of standard options that are supported on the current development environment and will be supported in future releases. An additional set of non-standard options are specific to the current virtual machine implementation and are subject to change in the future. Non-standard options begin with -X.
Standard Options
−g |
Generate debugging info |
−g:none
Generate no debugging info
−g:{source,lines,vars,notc}
Generate only some debugging info.
"source" generates only the source file attribute,
"lines" generates source and line number information,
"vars" generates source, line number and local variable information,
"notc" generates all of the above and will not perform tail call optimization.
−nowarn
Generate no warnings
−verbose
Output messages about what the compiler is doing
−classpath <path>
Specify where to find user class files (on Unix-based systems a colon-separated list of paths, on Windows-based systems, a semicolon-separate list of paths). This does not override the built-in ("boot") search path.
The default class path is the current directory. Setting the CLASSPATH variable or using the -classpath command-line option overrides that default, so if you want to include the current directory in the search path, you must include "." in the new settings.
−sourcepath <path>
Specify where to find input source files.
−bootclasspath <path>
Override location of bootstrap class files (where to find the standard built-in classes, such as "scala.List").
−extdirs <dirs>
Override location of installed extensions.
−d <directory>
Specify where to place generated class files.
−deprecation
Indicates whether source should be compiled with deprecation information; defaults to off (accepted values are: on, off, yes and no)
Available since Scala version 2.2.1
−encoding <encoding>
Specify character encoding used by source files.
The default value is platform-specific (Linux: "UTF8", Windows: "Cp1252"). Executing the following code in the Scala interpreter will return the default value on your system:
scala> new java.io.InputStreamReader(System.in).getEncoding
−target: <target>
Specify which backend to use (jvm-1.5,jvm-1.4,msil,cldc).
The default value is "jvm-1.4".
−migrate
Assist in migrating from Scala version 1.0.
−statistics
Print compiler statistics.
−resident
Compiler stays resident, files to compile are read from standard input.
−version
Print product version and exit.
−? | −help
Print a synopsis of standard options.
−nouescape
Disables handling of \u unicode escapes
Non-Standard
Options
−Xinline
Perform inlining when possible.
−Xcloselim
Perform closure elimination.
−Xshowcls <class>
Show class info.
−Xshowobj <object>
Show object info.
−Xshowicode
Print the generated ICode.
−Xlinearizer <Xlinearizer>
Linearizer to use (dfs,dump,normal,rpo).
The default value is "rpo".
−Xgenerics
Use generic Java types.
Debug Options
−debug |
Output debugging messages. |
−explaintypes
Explain type errors in more detail.
−uniqid
Print identifiers with unique names (debugging option).
−printtypes
Print tree types (debugging option).
−prompt
Display a prompt after each error (debugging option).
−noimports
Compile without any implicit imports.
−nopredefs
Compile without any implicit predefined values.
−skip: <phases>
Skip <phases> (see below).
−check: <phases>
Check the tree after <phases> (see below).
−print: <phases>
Print out program after <phases> (see below).
−printer: <printer>
Printer to use (text,html).
The default value is "text".
−print-file <file>
Specify file in which to print trees.
−graph: <phases>
Graph the program after <phases> (see below).
−stop: <phases>
Stop after first phase in <phases> (see below).
−log: <phases>
Log operations in <phases> (see below).
Compilation
Phases
initial
initializing compiler
parse |
parse source files |
|||
namer |
create symbols |
analyze
name and type analysis
refcheck
reference checking
uncurry
uncurry function types and applications
transmatch
translate match expressions
lambdalift
lambda lifter
typesasvalues
represent types as values
addaccessors
add accessors for constructor arguments
explicitouterclasses
make links from inner classes to enclosing one explicit
addconstructors
add explicit constructor for each class
tailcall
add tail-calls
wholeprog
perform whole program analysis
addinterfaces
add one interface per class
expandmixins
expand mixins by code copying
boxing |
makes boxing explicit |
erasure
type eraser
icode |
generate icode |
codegen
enable code generation
terminal
compilation terminated
all |
matches all phases |
ENVIRONMENT
JAVACMD
Specify the java command to be used for running the Scala code. Arguments may be specified as part of the environment variable; spaces, quotation marks etc., will be passed directly to the shell for expansion.
EXAMPLES
Compile a Scala program to the current directory
scalac HelloWorld
Compile a Scala program to the destination directory classes
scalac −d classes HelloWorld.scala
Compile a Scala program using a user-defined java command
env JAVACMD=/usr/local/bin/cacao scalac −d classes HelloWorld.scala
Compile all Scala files found
in the source directory src to the
destination directory classes
scalac −d classes src/*.scala
EXIT STATUS
scalac returns a zero exist status if it succeeds to compile the specified input files. Non zero is returned in case of failure.
AUTHOR
Written by Martin Odersky and other members of the Scala team.
REPORTING BUGS
Report bugs to <scala [AT] listes.ch>.
COPYRIGHT
This is free software; see the distribution for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.