From 397b783510ea6582a26434dafdfc94daa0a38afa Mon Sep 17 00:00:00 2001 From: Erwan Jahier <jahier@imag.fr> Date: Wed, 8 Apr 2015 16:42:15 +0200 Subject: [PATCH] Fixing and updating the lv6 manual. --- lv6-ref-man/Makefile | 20 ++++++++--- lv6-ref-man/lustokens | 4 +++ lv6-ref-man/lv6-ref-man.tex | 71 +++++++++++++++++++------------------ test/should_work/enum0.lus | 1 - 4 files changed, 56 insertions(+), 40 deletions(-) diff --git a/lv6-ref-man/Makefile b/lv6-ref-man/Makefile index f462507f..e24018f5 100644 --- a/lv6-ref-man/Makefile +++ b/lv6-ref-man/Makefile @@ -31,13 +31,14 @@ FIGS=\ # targets: lus 2 latex LUS2TEX= \ $(OBJPDF)/is_stable.lus.tex \ - $(OBJPDF)/struct.lus.tex \ + $(OBJPDF)/struct0.lus.tex \ $(OBJPDF)/consensus2.lus.tex \ $(OBJPDF)/count.lus.tex \ $(OBJPDF)/EDGE.lus.tex \ $(OBJPDF)/STABLE.lus.tex \ $(OBJPDF)/TIME_STABLE.lus.tex \ $(OBJPDF)/TIME_STABLE1.lus.tex \ + $(OBJPDF)/complex.lus.tex \ $(OBJPDF)/COUNTER.lus.tex \ $(OBJPDF)/SWITCH.lus.tex \ $(OBJPDF)/SWITCH1.lus.tex \ @@ -108,8 +109,19 @@ clean: #------------------------------ # Special : mly 2 latex #------------------------------ -$(PARSER): ../src/lv6parser.mly lustokens - mly2bnf ../src/lv6parser.mly -t lustokens | grep -v XXX > $@ + +BIN=/usr/local/tools/lustre/misc/bin + + +./$(OBJPDF)/lv6parser.tex: ./$(OBJPDF)/rules + cat $< | $(BIN)/rules2tex -t lustokens > $@ + +./$(OBJPDF)/rules : ../src/lv6parser.mly + $(BIN)/yacc2rules ../src/lv6parser.mly > $@ + +./$(OBJPDF)/cleanyacc : $(LUTINSRC)/lutParser.mly + cat $< | sed -e "s/lus//g" -e "s/TK_EOF//" > $@ + rere: touch ../src/lv6parser.mly @@ -139,7 +151,7 @@ $(OBJPDF)/%.lus.tex : $(LUSTRE_DIR)/%.lus $(OBJPDF)/%-broken.lus.tex : $(LUSTRE_DIR)/broken/%.lus utils/lus2tex $< > $@ -lus2tex: $(EXEMPLES) +lus2tex: $(LUS2TEX) # obsolete #lus2tex: diff --git a/lv6-ref-man/lustokens b/lv6-ref-man/lustokens index 41766063..065cd6ee 100644 --- a/lv6-ref-man/lustokens +++ b/lv6-ref-man/lustokens @@ -81,7 +81,11 @@ TK_IF if TK_WITH with TK_THEN then TK_ELSE else +TK_MERGE merge + +TK_UNSAFE unsafe +TK_SAFE safe TK_INCLUDE include TK_PROVIDES provides TK_MODEL model diff --git a/lv6-ref-man/lv6-ref-man.tex b/lv6-ref-man/lv6-ref-man.tex index 8ed68a5d..1da59b96 100644 --- a/lv6-ref-man/lv6-ref-man.tex +++ b/lv6-ref-man/lv6-ref-man.tex @@ -42,6 +42,7 @@ read directly this chapter. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \chapter{An Overview of the Lustre Language} @@ -631,6 +632,35 @@ that}. +%%% Include yacc syntax +%\newcommand{\bnftoken}[1]{{\color{blue2}\bfseries\ttfamily #1}} +%\newcommand{\bnftoken}[1]{{\color{blue2}\bfseries\ttfamily #1}} +%\newcommand{\bnftoken}[1]{{\bfseries\ttfamily #1}} +%\newcommand {\bnftoken}[1]{\mbox{\texttt{\textbf{#1}}}} + + +%\newcommand{\bnfrightident}[1]{{\color{black}\itshape #1}} +%\newcommand{\bnfrightident}[1]{\mbox{\color{black}\itshape \hyperlink{ebnf#1}{#1}}} + +%\newcommand{\bnfleftident}[1]{{\color{black}\itshape #1}} +\newcommand{\bnfleftident}[1]{{\color{black}\itshape \hypertarget{ebnf#1}{#1}}} + +\newcommand{\bnfdef}{\mbox{\color{red}$::=$}} +\renewcommand{\bnfor}{\mbox{\color{red3}$|$}} +\newcommand{\bnfopt}[1]{\mbox{\color{red3}$\lbrack$} #1 \mbox{\color{red3}$\rbrack$}} +\newcommand{\bnflist}[1]{\mbox{\color{red3}$\lbrace$} #1 \mbox{\color{red3}$\rbrace$}} +\newcommand{\bnfgroup}[1]{\mbox{\color{red3}$($} #1 \mbox{\color{red3}$)$}} + +%special lexical notations +\newcommand{\tkspecial}[1]{\mbox{\color{purple}\itshape #1}} +\newcommand{\tkident}{\tkspecial{ident}} +\newcommand{\tklongident}{\tkspecial{long\_ident}} +\newcommand{\tkreal}{\tkspecial{floating}} +\newcommand{\tkint}{\tkspecial{integer}} + +\input{lv6parser} + + \begin{itemize} \item One-line comments start with \key{--} and stop at the the end of the @@ -1142,7 +1172,7 @@ for their declaration and used is provided in Section~\ref{syntax}. \paragraph{Enumerations.} -\todo +Enumerations are similar to enumerations in other languages. \begin{example}[Enumerations] @@ -1155,7 +1185,7 @@ The declaration of a structured type is (semantically) equivalent to the declaration of an abstract type, a collection of field-access functions, and a constructor function. -\todo + \begin{example}[Records] @@ -1173,7 +1203,7 @@ functions, and a constructor function. \paragraph{Arrays.} -\todo +Here are a few examples of array declarations and definitions. \begin{example}[Arrays] \begin{alltt} @@ -1973,34 +2003,6 @@ y & 1 & 2 & 1 & 1 & 3 & 2\\ \section{The syntax rules (automatically generated)} -%%% Include yacc syntax -%\newcommand{\bnftoken}[1]{{\color{blue2}\bfseries\ttfamily #1}} -%\newcommand{\bnftoken}[1]{{\color{blue2}\bfseries\ttfamily #1}} -%\newcommand{\bnftoken}[1]{{\bfseries\ttfamily #1}} -\newcommand {\bnftoken}[1]{\mbox{\texttt{\textbf{#1}}}} - - -%\newcommand{\bnfrightident}[1]{{\color{black}\itshape #1}} -\newcommand{\bnfrightident}[1]{\mbox{\color{black}\itshape \hyperlink{ebnf#1}{#1}}} - -%\newcommand{\bnfleftident}[1]{{\color{black}\itshape #1}} -\newcommand{\bnfleftident}[1]{{\color{black}\itshape \hypertarget{ebnf#1}{#1}}} - -\newcommand{\bnfdef}{\mbox{\color{red}$::=$}} -\renewcommand{\bnfor}{\mbox{\color{red3}$|$}} -\newcommand{\bnfopt}[1]{\mbox{\color{red3}$\lbrack$} #1 \mbox{\color{red3}$\rbrack$}} -\newcommand{\bnflist}[1]{\mbox{\color{red3}$\lbrace$} #1 \mbox{\color{red3}$\rbrace$}} -\newcommand{\bnfgroup}[1]{\mbox{\color{red3}$($} #1 \mbox{\color{red3}$)$}} - -%special lexical notations -\newcommand{\tkspecial}[1]{\mbox{\color{purple}\itshape #1}} -\newcommand{\tkident}{\tkspecial{ident}} -\newcommand{\tklongident}{\tkspecial{long\_ident}} -\newcommand{\tkreal}{\tkspecial{floating}} -\newcommand{\tkint}{\tkspecial{integer}} - -\input{parser} - Lexical rules: \begin{itemize} @@ -2024,12 +2026,11 @@ is an two identifiers separated by a double colon (\bnfleftident{Ident}\bnftoken Lustre V1, v2, v3, ..., v6 -\section{The Lustre V4 features not supported in Lustre V6} +\section{Some Lustre V4 features not supported in Lustre V6} + +- recursive arrays slices : use iterators instead -- arrays -- include -- autre ??? \begin{alltt} [int, real] -> use structures instead diff --git a/test/should_work/enum0.lus b/test/should_work/enum0.lus index f3cd8d7a..a3af03b4 100644 --- a/test/should_work/enum0.lus +++ b/test/should_work/enum0.lus @@ -1,7 +1,6 @@ type color1 = enum { blue, white, black }; type color2 = enum { green, orange, yellow }; - node enum0(x: color1) returns (y: color2); let y = if x = blue then green else if x = white then orange else yellow; -- GitLab