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

SCM Repository

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

View of /trunk/doc/report/lang.tex

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1116 - (download) (as text) (annotate)
Thu May 5 04:49:02 2011 UTC (8 years, 2 months ago) by jhr
File size: 3031 byte(s)
  more merging of pure-cfg changes back into trunk
%!TEX root = report.tex
%
\chapter{The Diderot Language}
\label{chap:lang}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Global declarations}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Strand definitions}

\subsection{Strand state}

\subsection{The update method}

\subsection{The stabilize method}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Initialization}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Statements}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\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{}
  \TestExprRULES{}
  \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{If-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 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