Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /branches/vis12/doc/report/lang.tex
ViewVC logotype

View of /branches/vis12/doc/report/lang.tex

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2276 - (download) (as text) (annotate)
Fri Mar 8 12:15:27 2013 UTC (6 years, 7 months ago) by jhr
File size: 3723 byte(s)
  updating documentation
%!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