Context Navigation


Changeset 21


Ignore:
Timestamp:
Nov 23, 2007, 1:30:19 AM (18 years ago)
Author:
neil.c.c.brown
Message:

Defined an occam syntax highlighting mode, and changed the colour of the comments to save my eyes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • docs/trunk/200711-tock-seminars/200711-tock-slides.tex

    r20 r21
    44%{{{ header
    55%include polycode.fmt
    6(追記) (追記ここまで)
    67
    78\usepackage{pifont}
    6869% package does allow us to escape to maths mode, so perhaps we should try that...
    6970
    70\begin{document}
    71\lstdefinelanguage[21]{occam}
    72 {morekeywords={BYTE,FOR,FROM,INT,INT32,IS,PROC,RESHAPES,RETYPES,SEQ,SIZE,VAL},
    73 otherkeywords={:,:=},
    74 morecomment=[l]{--}
    75 }
    76
    77\definecolor{ForestGreen}{cmyk}{0.91,0,0.88,0.12}
    78
    79\def\haskellsettings{
    7180\lstset{
    7281 language={[improved]Haskell},
    7584 keywordstyle=\color{blue}\bfseries,
    7685 identifierstyle=,
    77 commentstyle=\color{(削除) g (削除ここまで)reen}\itshape,
    86 commentstyle=\color{(追記) ForestG (追記ここまで)reen}\itshape,
    7887 stringstyle=,
    7988 showstringspaces=false}
    89(追記) } (追記ここまで)
    90(追記) (追記ここまで)
    91(追記) \def\occamsettings{ (追記ここまで)
    92(追記) \lstset{ (追記ここまで)
    93(追記) language={[21]occam}, (追記ここまで)
    94(追記) columns=fixed, (追記ここまで)
    95(追記) basicstyle=\small\ttfamily, (追記ここまで)
    96(追記) keywordstyle=\color{blue}\bfseries, (追記ここまで)
    97(追記) identifierstyle=, (追記ここまで)
    98(追記) commentstyle=\color{ForestGreen}\itshape, (追記ここまで)
    99(追記) stringstyle=, (追記ここまで)
    100(追記) showstringspaces=false} (追記ここまで)
    101(追記) } (追記ここまで)
    102(追記) (追記ここまで)
    103(追記) \begin{document} (追記ここまで)
    104(追記) (追記ここまで)
    105(追記) \haskellsettings (追記ここまで)
    80106
    81107\begin{frame}
    475501\begin{frame}[fragile]
    476502\frametitle{Matching elements}
    477\begin{verbatim}
    503\occamsettings
    504\begin{lstlisting}
    478505x, y := y, x
    479506
    480507t := y
    481508y := x
    482x := t\end{verbatim}
    509x := t
    510\end{lstlisting}
    511\haskellsettings
    483512\begin{lstlisting}
    484513Assign p0 (VarList p0 ["x", "y"]) (ExprList p0 [JustVar "x", JustVar "y"])
    9951024\section{Language features}
    9961025
    997%TODO define a syntax-highlighting mode for occam, and change the occam
    998%code fragments to use it
    1026\occamsettings
    9991027
    10001028\begin{frame}[fragile]
    10041032 \item Instead, it has a very powerful reference (``abbreviation'') system
    10051033\end{itemize}
    1006\begin{verbatim}
    1007INT x: -- declares variable
    1008INT y IS x: -- declares reference to variable
    1009VAL INT y2 IS y: -- declares read-only reference to variable
    1010
    1011PROC foo (INT z) -- procedure that takes a reference
    1034\begin{lstlisting}
    1035INT x: -- declares variable
    1036INT y IS x: -- declares reference to variable
    1037VAL INT y2 IS y:
    1038 -- declares read-only reference to variable
    1039
    1040PROC foo (INT z) -- procedure that takes a reference
    10121041 z := 42
    10131042:
    1014\end{(削除) verbatim (削除ここまで)}
    1043\end{(追記) lstlisting (追記ここまで)}
    10151044\end{frame}
    10161045
    10241053 \end{itemize}
    10251054\end{itemize}
    1026\begin{(削除) verbatim (削除ここまで)}
    1027[10]INT xs: (削除) (削除ここまで)-- declares an array
    1055\begin{(追記) lstlisting (追記ここまで)}
    1056[10]INT xs: (追記) (追記ここまで)-- declares an array
    10281057SEQ
    1029 xs[15] := 42 (削除) (削除ここまで)-- would fail at compile time
    1030 xs[n] := 42 (削除) (削除ここまで)-- would fail at runtime if n >= 10
    1031
    1032 n := SIZE xs (削除) (削除ここまで)-- get size of the array
    1033
    1034 INT y IS xs[4]: (削除) (削除ここまで)-- abbreviate a member of the array
    1058 xs[15] := 42 (追記) (追記ここまで)-- would fail at compile time
    1059 xs[n] := 42 (追記) (追記ここまで)-- would fail at runtime if n >= 10
    1060
    1061 n := SIZE xs (追記) (追記ここまで)-- get size of the array
    1062
    1063 INT y IS xs[4]: (追記) (追記ここまで)-- abbreviate a member of the array
    10351064 y := 42
    10361065
    1037 [4]INT ys IS [xs FROM 4 FOR 5]: -- abbreviate a slice of the array
    1066 [4]INT ys IS [xs FROM 4 FOR 5]:
    1067 -- abbreviate a slice of the array
    10381068 ys[2] := 42
    1039\end{(削除) verbatim (削除ここまで)}
    1069\end{(追記) lstlisting (追記ここまで)}
    10401070\end{frame}
    10411071
    10721102\begin{frame}[fragile]
    10731103\frametitle{Retyping}
    1074\begin{(削除) verbatim (削除ここまで)}
    1104\begin{(追記) lstlisting (追記ここまで)}
    10751105INT32 i:
    10761106[4]BYTE bs RETYPES i:
    1077\end{(削除) verbatim (削除ここまで)}
    1107\end{(追記) lstlisting (追記ここまで)}
    10781108\begin{itemize}
    10791109 \item Data retyping
    10901120 \item Arrays can be reshaped!
    10911121\end{itemize}
    1092\begin{(削除) verbatim (削除ここまで)}
    1122\begin{(追記) lstlisting (追記ここまで)}
    10931123[4][3]INT xs:
    10941124[2][6]INT ys RESHAPES xs:
    1095\end{(削除) verbatim (削除ここまで)}
    1125\end{(追記) lstlisting (追記ここまで)}
    10961126\end{frame}
    10971127
    11111141\end{itemize}
    11121142\end{frame}
    1143(追記) (追記ここまで)
    1144(追記) \haskellsettings (追記ここまで)
    1145(追記) (追記ここまで)
    11131146%}}}
    11141147
    11271160 \begin{itemize}
    11281161 \item Nothing uses infinite data structures
    1129 \item Really want strict evaluation in most p(削除) al (削除ここまで)ces
    1162 \item Really want strict evaluation in most p(追記) la (追記ここまで)ces
    11301163 \begin{itemize}
    11311164 \item Force errors sooner!
Note: See TracChangeset for help on using the changeset viewer.

AltStyle によって変換されたページ (->オリジナル) /