SCM Repository
View of /trunk/doc/report/lang.tex
Parent Directory
|
Revision Log
Revision 2636 -
(download)
(as text)
(annotate)
Tue May 27 16:18:36 2014 UTC (7 years, 11 months ago) by jhr
File size: 3723 byte(s)
Tue May 27 16:18:36 2014 UTC (7 years, 11 months ago) by jhr
File size: 3723 byte(s)
Merging changes from vis12 branch (via staging). The main change is the new syntax for inputs (especially image inputs).
%!TEX root = report.tex % \chapter{The Diderot Language} \label{chap:lang} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Program structure} \begin{Grammar} \ProgramRULES{} \end{Grammar}% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Global declarations} \begin{Grammar} \GlobalDeclRULES{} \end{Grammar}% \subsection{Global variable declarations} \begin{Grammar} \VarDeclRULES{} \end{Grammar}% \subsection{Input variable declarations} \begin{Grammar} \InputDeclRULES{} \end{Grammar}% \subsection{Function declarations} \begin{Grammar} \FuncDeclRULES{} \ParamsRULES{} \ParamRULES{} \end{Grammar}% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Strand definitions} \begin{Grammar} \StrandDeclRULES{} \end{Grammar}% \subsection{Strand state} \begin{Grammar} \StrandStateDeclRULES{} \end{Grammar}% \subsection{The update method} \subsection{The stabilize method} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Initialization} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Statements} \begin{Grammar} \BlockRULES{} \StmtRULES{} \end{Grammar}% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Expressions} In this section, we describe Diderot's expression syntax. The section is organized from lowest to highest precedence. \subsection{Conditional expressions} There are three conditional expression forms in Diderot: \emph{if-else} expressions, \emph{or-else} expressions, and \emph{and-also} expressions. The syntax of these is given by the following grammar fragment: \begin{Grammar} \ExprRULES{} \OrExprRULES{} \AndExprRULES{} \end{Grammar}% \subsubsection{If-else expressions} The if-else expression has the following typing rule: \begin{displaymath} \infer{ \HasTy{\ENV}{e_1\;\mkw{if}\;e_2\;\mkw{else}\;e_3}{\tau} }{ \HasTy{\ENV}{e_1}{\tau} \quad \HasTy{\ENV}{e_2}{\TYbool} \quad \HasTy{\ENV}{e_3}{\tau} \quad } \end{displaymath}% Its semantics are that it evaluates $e_2$ first. If the value is true, then it evaluate $e_1$, otherwise it evaluates $e_3$. \subsubsection{Or-else expressions} \begin{displaymath} \infer{ \HasTy{\ENV}{e_1\;\mkw{||}\;e_2}{\TYbool} }{ \HasTy{\ENV}{e_1}{\TYbool} \quad \HasTy{\ENV}{e_2}{\TYbool} } \end{displaymath}% The or-else form is derived from the if-else form as follows: \begin{displaymath} e_1\;\mkw{||}\;e_2 \quad \equiv \quad \mkw{true}\;\mkw{if}\;e_1\;\mkw{else}\;e_2 \end{displaymath}% \subsubsection{And-also expressions} \begin{displaymath} \infer{ \HasTy{\ENV}{e_1\;\mkw{\&\&}\;e_2}{\TYbool} }{ \HasTy{\ENV}{e_1}{\TYbool} \quad \HasTy{\ENV}{e_2}{\TYbool} } \end{displaymath}% The and-also form is derived from the if-else form as follows: \begin{displaymath} e_1\;\mkw{\&\&}\;e_2 \quad \equiv \quad e_2\;\mkw{if}\;e_1\;\mkw{else}\;\mkw{false} \end{displaymath}% \subsection{Binary expressions} \begin{Grammar} \CmpExprRULES{} \CmpOpRULES{} \AddExprRULES{} \AddOpRULES{} \MulExprRULES{} \MulOpRULES{} \PowerExprRULES{} \ProbeExprRULES{} \end{Grammar}% \subsection{Prefix-operator expressions} \begin{Grammar} \PrefixExprRULES{} \end{Grammar}% \subsection{Suffix-operator expressions} \begin{Grammar} \SuffixExprRULES{} \SuffixRULES{} \IndexRULES{} \end{Grammar}% \subsection{Derivative expressions} \begin{Grammar} \DerivExprRULES{} \end{Grammar}% \subsection{Atomic expressions} \begin{Grammar} \AtomExprRULES{} \ArgumentsRULES{} \end{Grammar}%
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |