Commit fe00e975 authored by erwan's avatar erwan
Browse files

Doc: Rewrite the reference manual to use only the yacc2latex-generated rules

parent 59dd5c86
Pipeline #45281 passed with stages
in 5 minutes and 34 seconds
image: ocaml/opam2:ubuntu
image: ocaml/opam2:ubuntu-18.04
variables:
GIT_STRATEGY: clone
......
......@@ -154,6 +154,8 @@ A lustre file is either an old-fashioned list of item decl,
or a list of pack/model declaration
*/
/* ebnf:group=ProgramRules */
program: IncludeList PackBody TK_EOF
{
AstV6.PRPackBody(List.rev $1, $2)
......@@ -164,6 +166,7 @@ program: IncludeList PackBody TK_EOF
}
;
/* ebnf:group=PackageRules */
PackList: OnePack
{ [$1] }
| PackList OnePack
......@@ -179,6 +182,8 @@ OnePack: /* ebnf:print=short */
{ AstV6.NSPack $1 }
;
/* ebnf:group=ProgramRules */
Include: TK_INCLUDE TK_STRING
{ (Lxm.str $2) }
;
......@@ -195,6 +200,7 @@ Pour les provides, on rend des decls, bien
que syntaxiquement, on n'autorise pas n'importe quoi ...
*/
/* ebnf:group=ModelRules */
Provides:
/* nada */
{ None }
......@@ -247,13 +253,17 @@ Provide:
{ Lxm.flagit (TypeInfo (snd $2)) (fst $2) }
;
/* ebnf:group=ConstRules */
ConstDefOpt: /* ebnf:print=expand */
{ None}
| TK_EQ Expression
{
Some $2
}
;
;
/* ebnf:group=ModelRules */
ModelDecl:
TK_MODEL Lv6Id
Uses
......@@ -275,6 +285,7 @@ ModelDecl:
}
;
/* ebnf:group=PackageRules */
PackDecl:
TK_PACKAGE Lv6Id
......@@ -339,6 +350,7 @@ PackEq:
{it = pa; src = $2 }
}
;
/* ebnf:group=ProgramRules */
/* PackBody :
les informations collectes dans les tables
......@@ -380,8 +392,9 @@ OneDecl: /* ebnf:print=short */
;
/* Lv6Idifiers and lists */
/* ebnf:group=IdentVIRules */
Lv6IdRef: /* ebnf:print=ignore */
Lv6IdRef: /* ebnf print=ignore */
/* simple or long ... */
TK_IDENT
{ idref_of_lxm $1 }
......@@ -390,8 +403,9 @@ Lv6IdRef: /* ebnf:print=ignore */
;
/* Lv6Idifiers and lists */
/* ebnf:group=IdentRules */
Lv6Id: /* ebnf:print=ignore */
Lv6Id: /* ebnf print=ignore */
TK_IDENT Pragma
{ (Lv6parserUtils.make_ident $1 $2) }
;
......@@ -404,6 +418,8 @@ Lv6IdList: /* ebnf:print=expand */
{ $3::$1 }
;
/* ebnf:group=NodesRules */
TypedLv6IdsList: TypedLv6Ids
{ [ $1 ] }
| TypedLv6IdsList TK_SEMICOL TypedLv6Ids
......@@ -437,6 +453,7 @@ TypedValuedLv6Id :
/* constantes */
/* ebnf:group=ConstantDeclRules */
ConstDecl: TK_CONST ConstDeclList
{ treat_const_decl_list $2 }
......@@ -451,7 +468,7 @@ ConstDeclList:
/* Retourne une liste (lxm, const_info) */
OneConstDecl:
/* Les listes d'idents en partie gauche sont acceptées
/* Les listes d'idents en partie gauche sont acceptes
pour les constantes externes : */
Lv6Id TK_COLON Type
{ (make_external_const_list [$1] $3 ) }
......@@ -466,6 +483,7 @@ OneConstDecl:
/* types */
/* ebnf:group=TypeDeclRules */
TypeDecl: TK_TYPE TypeDeclList
{ List.iter treat_type_decl (List.rev $2) }
......@@ -509,6 +527,7 @@ OptStruct: /* ebnf:print=expand */
;
/* ebnf:group=SimpleTypeRules */
/* Notation de type "immdiat" */
Type:
/* prdfini */
......@@ -524,6 +543,7 @@ Type:
/* extern nodes */
/* ebnf:group=ExtNodesRules */
ExtNodeDecl:
TK_EXTERN TK_FUNCTION Lv6Id Params TK_RETURNS Params OptSemicol
......@@ -537,10 +557,11 @@ ExtNodeDecl:
;
/* noeuds */
/* ebnf:group=NodesRules */
NodeDecl: LocalNode {};
LocalNode:
LocalNode:
TK_NODE Lv6Id StaticParams Params TK_RETURNS Params OptSemicol
LocalDecls Body OptEndNode
{ treat_node_decl false true $2 $3 $4 $6 $8 (fst $9) (snd $9) }
......@@ -573,6 +594,7 @@ NodeProfileOpt :
Some (invars, outvars)
}
;
/* ebnf:group=StaticRules */
StaticParams: /*rien*/
{ [] }
......@@ -657,6 +679,7 @@ OptEndNode: /* ebnf:print=expand */
/* params de sortie :
type: sx_Param list = (((Lxm.t list) * type_exp) list * AstCore.clock_exp) list
*/
/* ebnf:group=NodesRules */
Params:
/* rien */
......@@ -668,9 +691,10 @@ Params:
{ (List.rev $2) }
;
/* Déclarations ocales(2010/07/02)
/* Dclarations locales(2010/07/02)
concret: liste de var(s) ou const
abstrait: couple liste de vars * list de consts
*/
LocalDecls:
/* nada */
......@@ -697,8 +721,8 @@ OneLocalDecl:
{ ([], $1) }
;
/* Déclaration de constantes locale (2010/07/02)
uniquement des constantes définies
/* Dclaration de constantes locale (2010/07/02)
uniquement des constantes dfinies
*/
LocalConsts:
TK_CONST ConstDeclList
......@@ -749,6 +773,8 @@ VarDecl:
/*
Retourne un couple (assertions list, equations list)
*/
/* ebnf:group=BodyRules */
Body:
TK_LET TK_TEL
{ ([], []) }
......@@ -772,6 +798,7 @@ Equation: TK_ASSERT Expression TK_SEMICOL
/* partie gauche d'equation */
/* ebnf:group=LeftRules */
Left: LeftItemList
/* WARNING ! il faut remettre la liste l'endroit */
......@@ -810,6 +837,7 @@ TableLeftItem:
/* partie droite d'equation (expression) */
/* ebnf:group=ExpressionRules */
Expression:
/* zroaires */
Constant { $1 }
......@@ -884,6 +912,16 @@ Expression:
{ make_merge_op $2 $3 }
;
/* WARNING ! : les listes sont cres l'envers */
ExpressionList:
/* empty */
{ [] }
| Expression
{ [$1] }
| ExpressionList TK_COMA Expression
{ $3::$1 }
;
/* ebnf:group=MergeRules */
MergeCaseList:
| MergeCase
{ [$1] }
......@@ -900,6 +938,7 @@ MergeCase:
{ (Bool false, $2,$4) }
;
/* ebnf:group=ExpressionRules */
ClockExpr:
Lv6IdRef TK_OPEN_PAR Lv6Id TK_CLOSE_PAR
{ (make_clock_exp $1.it $3) }
......@@ -909,6 +948,8 @@ ClockExpr:
{ (make_clock_exp (Lv6Id.idref_of_string "Lustre::false") $3) }
;
/* ebnf:group=PredefRules */
PredefOp: /* ebnf:print=short */
TK_NOT { make_predef_posop $1 NOT_n }
| TK_FBY { {src=$1; it=FBY_n} }
......@@ -943,7 +984,9 @@ PredefOp: /* ebnf:print=short */
/* Appel fonctionnel par position (classique) */
/* NB
On a 2 rgles cause des appels chantillonns
*/
*/
/* ebnf:group=ExpressionRules */
CallByPosExpression:
/*
EffectiveNode TK_OPEN_PAR Expression TK_CLOSE_PAR
......@@ -955,6 +998,7 @@ CallByPosExpression:
;
/* Effective node : une constrcution qui designe un noeud */
/* ebnf:group=StaticRules */
EffectiveNode:
/* Juste un nom */
......@@ -1143,6 +1187,8 @@ SimpleExpList: SimpleExp
Actuellement, uniquement pour les structures,
donc pas de soucis d'chantillonnage
*/
/* ebnf:group=ExpressionByNamesRules */
CallByNameExpression:
/* WARNING ! il faut remettre la liste l'endroit */
| Lv6IdRef TK_OPEN_BRACE CallByNameParamList OptSemicol TK_CLOSE_BRACE
......@@ -1179,16 +1225,7 @@ CallByNameParam:
{ ({it=Lxm.id $1;src=$1} , $3) }
;
/* WARNING ! : les listes sont cres l'envers */
ExpressionList:
/* empty */
{ [] }
| Expression
{ [$1] }
| ExpressionList TK_COMA Expression
{ $3::$1 }
;
/* ebnf:group=ConstantRules */
Constant: /* ebnf:print=short */
TK_TRUE
{ (leafexp_predef $1 TRUE_n) }
......@@ -1200,6 +1237,7 @@ Constant: /* ebnf:print=short */
{ (leafexp_predef $1 ((RCONST_n (Lxm.id $1)))) }
;
IntConst: /* ebnf:print=ignore */
TK_ICONST
{ $1 }
......@@ -1210,6 +1248,7 @@ RealConst: /* ebnf:print=ignore */
{ $1 }
;
/* ebnf:group=LeftRules */
Select:
Expression TK_CDOTS Expression Step
{ {it={si_first = $1; si_last = $3 ; si_step = $4 }; src = $2} }
......@@ -1233,6 +1272,7 @@ OptSemicol : /* ebnf:print=expand */
{}
;
/* ebnf:group=IdentRules */
Pragma: /* e.g., %ASSUME:toto% */
{ [] } /* produces 3 shift reduce conflicts! */
| TK_PCENT TK_IDENT TK_COLON TK_IDENT TK_PCENT Pragma
......
......@@ -80,9 +80,9 @@ h:$(SRCS)
#------------------------------
#------------------------------
$(MAIN).pdf : $(PARSER) $(SRCS) $(LUS2TEX) $(SUMMARY) $(FIGS) $(OBJPDF)/version.tex
(cd objpdf; pdflatex ../$(MAIN).tex ; bibtex $(MAIN) )
(cd objpdf; pdflatex ../$(MAIN).tex )
mv objpdf/$(MAIN).pdf .
cp $(MAIN).pdf /import/www/DIST-TOOLS/SYNCHRONE/lustre-v6/doc || true
scp $(MAIN).pdf jahier@pressembois.imag.fr:/import/www/DIST-TOOLS/SYNCHRONE/lustre-v6/doc || true
#------------------------------
# Special : fig 2 latex 2 pdf
......@@ -142,16 +142,16 @@ LUSTRE_DIR_bad=../test/should_fail
# Generic rule for .lus.tex targets
# - All lus files must be in some subdir of LUSTRE_DIR
$(OBJPDF)/%-bad.lus.tex : $(LUSTRE_DIR_bad)/*/%.lus
utils/lus2tex $< > $@
utils/lus2tex $< small > $@
$(OBJPDF)/%.lus.tex : $(LUSTRE_DIR)/%.lus
utils/lus2tex $< > $@
utils/lus2tex $< small > $@
$(OBJPDF)/%.lus.github.tex : $(GITHUB_DIR)/%.lus
utils/lus2tex $< > $@
utils/lus2tex $< scriptsize > $@
$(OBJPDF)/%-broken.lus.tex : $(LUSTRE_DIR)/broken/%.lus
utils/lus2tex $< > $@
utils/lus2tex $< small > $@
lus2tex: $(LUS2TEX)
......
......@@ -98,4 +98,3 @@ TK_USES uses
TK_STRUCT struct
TK_PCENT %
TK_STRING "\"<string>\""
TK_SLICE_START XXXDELETE_ME
This diff is collapsed.
......@@ -122,13 +122,7 @@
Last update: \today}
%\newcommand{\sx}[1]{{\bf \mbox{\it \hyperlink{#1}{#1} }}}
\newcommand{\sx}[1]{{\bf $\langle$\mbox{\it \hyperlink{#1}{#1}$\rangle$}}}
\newcommand{\sxDef}[1]{{\bf $\langle$\mbox{\it \hypertarget{#1}{#1}$\rangle$}}}
%\newcommand{\sx}[1]{$\langle$\mbox{\it\kwdd{#1}}$\rangle$}
%% \newcommand{\lx}[1]{``\mbox{\tt #1}''}
......@@ -137,7 +131,7 @@ Last update: \today}
\newcommand{\myor}{\\ &$|$&}
\newcommand{\sor}{$\;|\;$}
\newcommand{\mysp}{\hspace*{8mm}}
\newcommand{\prag}{\sx{$\cal P$}}
\newcommand{\prag}{{$\cal P$}}
\newcommand{\conc}[1]{#1}
\newcommand{\abst}[1]{#1}
......
......@@ -5,14 +5,14 @@
FILE=$1
SIZE=$2
/bin/echo "
% Automatically generated by $0
% from file $@
% the `date`
\begin{minipage}{\textwidth}
\begin{small}
\begin{$2}
\begin{alltt}
"
......@@ -60,7 +60,7 @@ cat $FILE \
echo "\end{alltt}
\end{small}
/bin/echo "\end{alltt}
\end{$2}
\end{minipage}
"
\ No newline at end of file
==> lus2lic0.sum <==
Test run by jahier on Tue Mar 17 15:59:19
Test run by jahier on Fri Jun 12 11:28:54
Native configuration is x86_64-pc-linux-gnu
=== lus2lic0 tests ===
......@@ -66,7 +66,7 @@ XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/lecte
XFAIL: Test bad programs (assert): test_lus2lic_no_node should_fail/assert/s.lus
==> lus2lic1.sum <==
Test run by jahier on Tue Mar 17 15:59:20
Test run by jahier on Fri Jun 12 11:28:55
Native configuration is x86_64-pc-linux-gnu
=== lus2lic1 tests ===
......@@ -413,7 +413,7 @@ PASS: ./lus2lic {-2c multipar.lus -n multipar}
PASS: sh multipar.sh
==> lus2lic2.sum <==
Test run by jahier on Tue Mar 17 15:59:54
Test run by jahier on Fri Jun 12 11:29:19
Native configuration is x86_64-pc-linux-gnu
=== lus2lic2 tests ===
......@@ -753,7 +753,7 @@ PASS: sh zzz2.sh
PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c zzz2.lus {}
==> lus2lic3.sum <==
Test run by jahier on Tue Mar 17 16:00:36
Test run by jahier on Fri Jun 12 11:29:48
Native configuration is x86_64-pc-linux-gnu
=== lus2lic3 tests ===
......@@ -1267,7 +1267,7 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node multipar.lus {}
==> lus2lic4.sum <==
Test run by jahier on Tue Mar 17 16:01:24
Test run by jahier on Fri Jun 12 11:30:31
Native configuration is x86_64-pc-linux-gnu
=== lus2lic4 tests ===
......@@ -1759,7 +1759,7 @@ PASS: /home/jahier/lus2lic/test/../utils/test_lus2lic_no_node zzz2.lus {}
# of expected failures 54
==> lus2lic1.sum <==
PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c multipar.lus 42945 {}
PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c multipar.lus 46317 {}
=== lus2lic1 Summary ===
......@@ -1788,13 +1788,13 @@ PASS: /home/jahier/lus2lic/test/../utils/compare_exec_and_2c multipar.lus 42945
===============================
# Total number of failures: 10
lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 1 seconds
lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 34 seconds
lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 42 seconds
lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 48 seconds
lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 27 seconds
lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 24 seconds
lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 29 seconds
lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 43 seconds
lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 23 seconds
* Ref time:
91.35user 25.60system 2:31.55elapsed 77%CPU (0avgtext+0avgdata 283744maxresident)k
8inputs+149864outputs (0major+11398400minor)pagefaults 0swaps
71.69user 16.57system 1:59.66elapsed 73%CPU (0avgtext+0avgdata 42220maxresident)k
16inputs+147896outputs (0major+8462673minor)pagefaults 0swaps
* Quick time (-j 4):
103.77user 26.30system 1:25.06elapsed 152%CPU (0avgtext+0avgdata 283240maxresident)k
10496inputs+147536outputs (7major+11271430minor)pagefaults 0swaps
91.89user 18.09system 0:57.95elapsed 189%CPU (0avgtext+0avgdata 42124maxresident)k
80inputs+139528outputs (0major+8011124minor)pagefaults 0swaps
type alias = int;
type pair = struct { a:int; b:int };
type pair = struct { a:alias ; b:int };
type color = enum { blue, white, black };
node type_decl(i1, i2: int) returns (x: pair);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment