Commit c0fa7984 authored by Michael Hanus 's avatar Michael Hanus
Browse files

Minor corrections to syntax description

parent 448c48b4
......@@ -5,6 +5,7 @@
\production{Module}{
\term{module} ModuleID \opt{Exports} \term{where} Block
\alt Block
}
\lexicon{ModuleID}
......@@ -86,12 +87,17 @@
\lexicon{LabelID}
\production{TypeExpr}{
SimpleTypeExpr \opt{\term{->} TypeExpr}
TypeConsExpr \opt{\term{->} TypeExpr}
}
\production{TypeConsExpr}{
QTypeConstrID \seq{SimpleTypeExpr}{}{n} \marg{n > 0}
\alt SimpleTypeExpr
}
\production{SimpleTypeExpr}{
QTypeConstrID \seq{SimpleTypeExpr}{}{n} \marg{n \geqslant 0}
\alt TypeVarID $|$ \term{\us}
TypeVarID $|$ \term{\us}
\alt QTypeConstrID
\alt \term{()} \marg{\mbox{\it unit type}}
\alt \term{(} \seq{TypeExpr}{,}{n} \term{)}\marg{\mbox{\it tuple type, } n>1}
\alt \term{[} TypeExpr \term{]} \marg{\mbox{\it list type}}
......@@ -101,7 +107,7 @@
\lexicon{TypeVarID}
\production{FixityDeclaration}{
FixityKeyword Natural \seq{InfixOpID}{,}{n} \marg{n>0}
FixityKeyword Natural \seq{InfixOp}{,}{n} \marg{n>0}
% \offside{FixityArgument}{;}{n} \marg{n>0}
}
......@@ -111,7 +117,7 @@
%\production{FixityArgument
% Natural
% \seq{InfixOpID}{,}{n} \marg{n>0}
% \seq{InfixOp}{,}{n} \marg{n>0}
%}
\production{Natural}{ Digit $|$ Digit Natural }
......@@ -121,8 +127,6 @@
\term{5} $|$ \term{6} $|$ \term{7} $|$ \term{8} $|$ \term{9}
}
\lexicon{InfixOpID}
\production{FunctionDeclaration}{
Signature $|$ Equat
}
......@@ -152,7 +156,7 @@
\production{FunLHS}{
FunctionName \seq{SimplePat}{}{n} \marg{n \geqslant 0}
\alt SimplePat InfixOpID SimplePat
\alt SimplePat InfixOp SimplePat
}
\production{Pattern}{
......@@ -180,10 +184,10 @@
\lexicon{VariableID}
\production{LocalDefs}{
\offside{ValueDeclaration}{;}{n} \marg{n > 0}
\offside{LocalDeclaration}{;}{n} \marg{n > 0}
}
\production{ValueDeclaration}{
\production{LocalDeclaration}{
FunctionDeclaration
\alt PatternDeclaration
\alt \seq{VariableID}{,}{n} \term{free} \marg{n > 0}
......@@ -203,7 +207,7 @@
}
\production{InfixExpr}{
NoOpExpr QInfixOpID InfixExpr \margtext{infix operator application}
NoOpExpr QInfixOp InfixExpr \margtext{infix operator application}
\alt \term{-} InfixExpr \margtext{unary minus}
\alt NoOpExpr
}
......@@ -213,8 +217,8 @@
\alt \term{let} LocalDefs \term{in} Expr \marg{\mbox{\it let expression}}
\alt \term{if} Expr \term{then} Expr \term{else} Expr
\marg{\mbox{\it conditional}}
\alt \term{case} Expr \term{of} \offside{Alt}{;}{n} \marg{\mbox{\it case expression,~} n \geqslant 0}
\alt \term{fcase} Expr \term{of} \offside{Alt}{;}{n} \marg{\mbox{\it fcase expression,~} n \geqslant 0}
\alt \term{case} Expr \term{of} \offside{Alt}{;}{n} \marg{\mbox{\it case expression,~} n \geqslant 1}
\alt \term{fcase} Expr \term{of} \offside{Alt}{;}{n} \marg{\mbox{\it fcase expression,~} n \geqslant 1}
\alt \term{do} \term{\{}\seq{Stmt}{;}{n} \term{;} Expr \term{\}} \marg{\mbox{\it do expression,~} n \geqslant 0}
\alt FunctExpr
}
......@@ -224,11 +228,10 @@
}
\production{BasicExpr}{
QVariableID \marg{\mbox{\it variable}}
VariableID \marg{\mbox{\it variable}}
\alt \term{\us} \marg{\mbox{\it anonymous free variable}}
\alt QDataConstrID \marg{\mbox{\it data constructor}}
\alt QFunctionID \marg{\mbox{\it defined function}}
\alt \term{(} QInfixOpID \term{)} \marg{\mbox{\it operator function}}
\alt QFunctionName \marg{\mbox{\it defined function}}
\alt Literal
\alt \term{()} \marg{\mbox{\it empty tuple}}
\alt \term{(} Expr \term{)} \marg{\mbox{\it parenthesized expression}}
......@@ -239,16 +242,16 @@
\marg{\mbox{\it arithmetic sequence}}
\alt \term{[} Expr \term{|} \seq{Qual}{,}{n} \term{]}
\marg{\mbox{\it list comprehension, $n\geqslant 1$}}
\alt \term{(} Expr QInfixOpID \term{)} \marg{\mbox{\it left section}\index{section}\index{section!left}\index{left section}}
\alt \term{(} QInfixOpID Expr \term{)} \marg{\mbox{\it right section}\index{section}\index{section!right}\index{right section}}
\alt \term{(} Expr QInfixOp \term{)} \marg{\mbox{\it left section}\index{section}\index{section!left}\index{left section}}
\alt \term{(} QInfixOp Expr \term{)} \marg{\mbox{\it right section}\index{section}\index{section!right}\index{right section}}
\alt QDataConstrID \term{\{} \seq{FBind}{,}{n} \term{\}}
\margcomb{labeled construction}{n \geq 0}\index{label}\index{construction}\index{labeled construction}
\margcomb{labeled construction}{n \geqslant 0}\index{label}\index{construction}\index{labeled construction}
\alt \without{BasicExpr}{QDataConstrID} \term{\{} \seq{FBind}{,}{n} \term{\}}
\nextline
\margcomb{labeled update}{n > 0}\index{label}\index{update}\index{labeled update}
}
\production{FBind}{ QLabelID \term{=} TypedExpr }
\production{FBind}{ QLabelID \term{=} Expr }
\production{Alt}{
Pattern \term{->} Expr \opt{\term{where} LocalDefs}
......@@ -271,17 +274,21 @@
\alt Pattern \term{<-} Expr
}
\production{QInfixOp}{QInfixOpID \alt \term{`}QFunctionID\term{`}}
\production{InfixOp}{InfixOpID \alt \term{`}FunctionID\term{`}}
\production{QTypeConstrID}{\opt{ModuleID \term{.}} TypeConstrID}
\production{QDataConstrID}{\opt{ModuleID \term{.}} DataConstrID}
\production{QInfixOpID }{\opt{ModuleID \term{.}} InfixOpID }
\production{QFunctionID }{\opt{ModuleID \term{.}} FunctionID }
\production{QVariableID }{\opt{ModuleID \term{.}} VariableID }
\production{QLabelID }{\opt{ModuleID \term{.}} LabelID }
\production{Literal}{
Int \sor Char \sor String \sor Float
}
\lexicon{InfixOpID}
\lexicon{Int}
\lexicon{Char}
\lexicon{String}
......@@ -290,7 +297,7 @@
} % end parindent definition
\vspace{3ex}\noindent
If the alternative \emph{FunctionDeclaration} is used in
a \emph{ValueDeclaration}, then the left-hand side (\emph{FunLHS})
a \emph{LocalDeclaration}, then the left-hand side (\emph{FunLHS})
must have at least one pattern after the \emph{FunctionName}
(instead of zero patterns which is possible in top-level
function declarations).
......
......@@ -29,7 +29,7 @@ the indentation of the list terminates the entire list.
Moreover, a list started by \term{let} is terminated by the
keyword \code{in}. Thus, the sentence
\begin{curry}
f x = h x where \{g y = y+1 ; h z = (g z) * 2 \}
f x = h x where { g y = y+1 ; h z = (g z) * 2 }
\end{curry}
which is valid w.r.t.\ the context-free syntax, is written
with the layout rules as
......
......@@ -7,7 +7,7 @@
{\Huge\bf Curry}\\[4ex]
{\LARGE\bf An Integrated Functional Logic Language}\\[5ex]
{\large\bf Version 0.9.0}\\[1ex]
{\large November 17, 2015}\\[6ex]
{\large January 11, 2016}\\[6ex]
\Large
Michael Hanus$^1$ [editor] \\[3ex]
{\large Additional Contributors:}\\[2ex]
......
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