Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Why3
why3
Commits
6c2c5eff
Commit
6c2c5eff
authored
Dec 15, 2010
by
Jean-Christophe Filliâtre
Browse files
doc: syntax of formulas
parent
7aaff834
Changes
6
Hide whitespace changes
Inline
Side-by-side
Makefile.in
View file @
6c2c5eff
...
...
@@ -749,7 +749,8 @@ clean::
DOC
=
doc/manual.pdf
# doc/manual.html
BNF
=
doc/term_bnf.tex
BNF
=
qualid term formula
BNFTEX
=
$(
addprefix
doc/,
$(
addsuffix
_bnf.tex,
$(BNF)
))
doc/%_bnf.tex
:
doc/%.bnf doc/bnf
doc/bnf
$<
>
$@
...
...
@@ -762,7 +763,7 @@ doc: $(DOC)
.PHONY
:
$(DOC)
doc/manual.pdf
:
$(BNF) doc/apidoc.tex doc/manual.tex doc/version.tex
doc/manual.pdf
:
$(BNF
TEX
) doc/apidoc.tex doc/manual.tex doc/version.tex
cd
doc
;
rubber
-d
manual.tex
# doc/manual.html: doc/manual.tex doc/version.tex
...
...
doc/formula.bnf
0 → 100644
View file @
6c2c5eff
\begin{syntax}
formula ::= "true" | "false" ;
| formula "->" formula ; implication
| formula "<->" formula ; equivalence
| formula "and" formula ; conjunction
| formula "/\" formula ; asymmetric conjunction
| formula "or" formula ; disjunction
| formula "\/" formula ; asymmetric disjunction
| "not" formula ; negation
| lqualid ; symbol
| prefix-op term ;
| term infix-op term ;
| lqualid term+ ; predicate application
| "if" formula "then" formula ;
"else" formula ; conditional
| "let" pattern "=" term "in" formula ; local binding
| "match" ("," term)+ "with" ;
"|"? ("|" formula-case)+ "end" ; pattern matching
| quantifier ("," binders )+ ;
triggers "." formula ; quantifier
| label formula ; label
| "(" formula ")" ; parentheses
\
quantifier ::= "forall" | "exists"
\
binders ::= lident+ ":" type
\
formula-case ::= pattern "->" formula ; %
\end{syntax}
doc/qualid.bnf
0 → 100644
View file @
6c2c5eff
\begin{syntax}
lalpha ::= "a"-"z" | "_"
\
ualpha ::= "A"-"Z"
\
lident ::= lalpha (alpha | digit | "'")*
\
uident ::= ualpha (alpha | digit | "'")*
\
lqualid ::= lident | uqualid "." lident ;
\
uqualid ::= uident | uqualid "." uident ;%
\end{syntax}
doc/syntaxref.tex
View file @
6c2c5eff
\chapter
{
Syntax Reference
}
\label
{
chap:syntaxref
}
This chapter gives the grammar for the input files
This chapter gives the grammar for the input files
.
\framebox
{
\input
{
./term
_
bnf.tex
}}
TODO: constants
\paragraph
{
Identifiers.
}
\begin{center}
\framebox
{
\input
{
./qualid
_
bnf.tex
}}
\end{center}
\paragraph
{
Terms.
}
The syntax of terms is given Figure~
\ref
{
fig:bnf:term
}
.
TODO: prefix and infix operators
\begin{figure}
\begin{center}
\framebox
{
\input
{
./term
_
bnf.tex
}}
\end{center}
\caption
{
Syntax of terms.
}
\label
{
fig:bnf:term
}
\end{figure}
\paragraph
{
Formulas.
}
The syntax of terms is given Figure~
\ref
{
fig:bnf:formula
}
.
\begin{figure}
\begin{center}
\framebox
{
\input
{
./formula
_
bnf.tex
}}
\end{center}
\caption
{
Syntax of formulas.
}
\label
{
fig:bnf:formula
}
\end{figure}
%%% Local Variables:
%%% mode: latex
...
...
doc/term.bnf
View file @
6c2c5eff
\begin{syntax}
term ::= integer ; integer constant
| real ; real constant
| qualid ; symbol
| prefix-op term ;
| term infix-op term ;
| lqualid term+ ; function application
| "if" formula "then" term "else" term ; conditional
| "let" pattern "=" term "in" term ; local binding
| "match" ("," term)+ "with" "|"? match-cases "end" ;
term ::= integer ; integer constant
| real ; real constant
| lqualid ; symbol
| prefix-op term ;
| term infix-op term ;
| lqualid term+ ; function application
| "if" formula "then" term ;
"else" term ; conditional
| "let" pattern "=" term "in" term
; local binding
| "match" ("," term)+ "with" ;
"|"? ("|" term-case)+ "end" ; pattern matching
| "(" term ("," term)* ")" ; tuple
| term ":" type ; cast
| label term ; label
| "(" term ")" ; parentheses%
\end{syntax}
| term ":" type ; cast
| label term ; label
| "(" term ")" ; parentheses
\
term-case ::= pattern "->" term ;
\
pattern ::= pattern "|" pattern ; or pattern
| pattern "," pattern ; tuple
| "_" ; catch-all
| lident ; variable
| uident pattern* ; constructor
| "(" pattern ")" ; parentheses
| pattern "as" lident ; binding %
\end{syntax}
\ No newline at end of file
tests/test-jcf.why
View file @
6c2c5eff
...
...
@@ -6,7 +6,8 @@ theory List
use import bool.Bool
logic x : int = if true then 1 else 3
logic x : int = match 1,2 with X u,y -> 3 end
end
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment