Spec driver section

This commit is contained in:
Dmitry Boulytchev 2020-02-10 04:05:53 +03:00
parent e8675153c2
commit 0b26e754e3
7 changed files with 62 additions and 4 deletions

View file

@ -113,7 +113,7 @@ Multiple postfixes are allowed, for example
The basic form of expression is \nonterm{primary}. The simplest form of primary is an identifier or constant. Keywords \lstinline|true| and \lstinline|false| The basic form of expression is \nonterm{primary}. The simplest form of primary is an identifier or constant. Keywords \lstinline|true| and \lstinline|false|
designate integer constants 1 and 0 respectively, character constant is implicitly converted into its ASCII code. String constants designate arrays designate integer constants 1 and 0 respectively, character constant is implicitly converted into its ASCII code. String constants designate arrays
of one-byte characters. Infix constants allow to reference a functional value associated with corresponding infix operator, and functional constant (\emph{lambda-expression}) of one-byte characters. Infix constants allow to reference a functional value associated with corresponding infix operator, and functional constant (\emph{lambda-expression})
designates a anonymous functional value in the form of closure. designates an anonymous functional value in the form of closure.
\subsection{\lstinline|skip| and \lstinline|return| Expressions} \subsection{\lstinline|skip| and \lstinline|return| Expressions}

View file

@ -1 +0,0 @@
\chapter{Driver Options and Separate Compilation}

View file

@ -0,0 +1,10 @@
\chapter{Extensions}
\label{sec:extensions}
\section{Custom Infix Operators}
\section{Lazy Values and Eta-extension}
\section{Dot Notation}
\section{Mutable Closures}

View file

@ -0,0 +1,41 @@
\chapter{Driver Options and Separate Compilation}
\label{sec:driver}
Driver is a command-line unitility "\texttt{lamac}" which controls the invocation of the compiler. The
general format of invocation is
\begin{lstlisting}
lamac $\;options\; filename$
\end{lstlisting}
Only one file name can be processed at once, the file name and the options can be specified in
arbitrary order.
The driver operates in a few modes:
\begin{itemize}
\item Interpreter mode. Performs an interpretation of a source program using the reference source-level interpreter ("\texttt{-i}") or
compiles and runs a source on the stack machine ("\texttt{-s}"). In this mode separate compilation is not supported, thus no external
units can be accessed (including "\lstinline|Std|"), only the standard set of builtins is available.
\item Native mode, compilation ("\lstinline{-c}"). Compiles a source file into native code and writes an object file. All referenced
external unit interfaces must have to be accessible; however no linking is performed and no executable is built.
\item Native mode, build (default). Same as for the native compilation, but additionally performs linking with the runtime library and
all external units object files, generating executable.
\end{itemize}
Additionally, the following options can be given to the driver:
\begin{itemize}
\item "\texttt{-I $path$}"~--- specifies a path to look for external units. Multiples instances of this option can be given in driver's
invocation, and the paths are looked up in that order.
\item "\texttt{-dp}"~--- forced the driver to dump the AST of compiled unit. The dump is written in the file with the same
basename as the source one, with the extension replaced with "\texttt{.ast}".
\item "\texttt{-ds}"~--- forces the driver to sump stack machine code. The option is only in effect in stack interpreter on
native mode. The sump is written in the file "\texttt{.sm}".
\item "\texttt{-v}"~--- makes the dirver to print the version of the compiler.
\item "\texttt{-h}"~--- makes the driver to print the helpon options.
\end{itemize}
Apart from the paths specified by the "\texttt{-I}" option the driver uses the environment variable "\texttt{LAMA\_STD}"
to locate the runtime and standard libraries (see~\ref{sec:stdlib}). Thus, the units from standard libraries are accessible
without any "-I" option given.

7
doc/spec/Makefile Normal file
View file

@ -0,0 +1,7 @@
all:
pdflatex spec.tex
bibtem spec
pdflatex.tex
clean:
rm -Rf *~ *.log *.aux

View file

@ -129,8 +129,9 @@ language=alm
\input{01.introduction} \input{01.introduction}
\input{02.abstract_syntax_and_semantics} \input{02.abstract_syntax_and_semantics}
\input{03.concrete_syntax} \input{03.concrete_syntax}
\input{04.driver_options} \input{04.extensions}
\input{05.standard_library} \input{05.driver_options}
\input{06.standard_library}
\bibliographystyle{plainurl} \bibliographystyle{plainurl}
\bibliography{spec} \bibliography{spec}