Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
cloogle.org
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Cloogle
cloogle.org
Commits
2d52ed55
Verified
Commit
2d52ed55
authored
Jul 06, 2018
by
Camil Staps
🚀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add syntax documentation (
#180
)
parent
e092818f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
1 deletion
+59
-1
backend/Builtin/Syntax.icl
backend/Builtin/Syntax.icl
+59
-1
No files found.
backend/Builtin/Syntax.icl
View file @
2d52ed55
...
...
@@ -22,6 +22,7 @@ builtin_syntax =
[
bs_case
,
bs_class
,
bs_code
,
bs_comments
,
bs_context
,
bs_define_constant
,
bs_define_graph
...
...
@@ -31,7 +32,9 @@ builtin_syntax =
,
bs_forall
,
bs_foreign
,
bs_funcdep
,
bs_function_definition
,
bs_generic
,
bs_hierarchical_modules
,
bs_import
,
bs_infix
,
bs_instance
...
...
@@ -54,6 +57,8 @@ builtin_syntax =
,
bs_strict
,
bs_synonym
,
bs_synonym_abstract
,
bs_type_definition
,
bs_type_specification
,
bs_unique
,
bs_update_array
,
bs_update_record
...
...
@@ -115,8 +120,17 @@ bs_code =
]
}
bs_comments
=
{
syntax_title
=
"comments"
,
syntax_patterns
=
map
exact
[
"//"
,
"/
\\
*.*
\\
*/"
]
,
syntax_code
=
[
"// ..."
,
"/* ... */"
]
,
syntax_description
=
"`//` adds a single-line comment. `/*` and `*/` encapsulate a multi-line comment. Multi-line comments can be nested."
,
syntax_doc_locations
=
[
CLR
15
"B.2"
"_Toc311798132"
]
,
syntax_examples
=
[]
}
bs_context
=
{
syntax_title
=
"
T
ype context"
{
syntax_title
=
"
t
ype context"
,
syntax_patterns
=
map
exact
[
"
\\
|"
,
"&"
,
","
,
"special"
]
,
syntax_code
=
[
":: ... | ..., ... [special ...=...]"
,
"| ... & ..., ..."
]
,
syntax_description
=
join
"
\n
"
...
...
@@ -253,6 +267,17 @@ bs_funcdep =
]
}
bs_function_definition
=
{
syntax_title
=
"function definition"
,
syntax_patterns
=
map
exact
[
"="
]
,
syntax_code
=
[
"... = ..."
]
,
syntax_description
=
"Specifies the implementation of a function."
,
syntax_doc_locations
=
[
CLR
5
"3"
"_Toc311797995"
]
,
syntax_examples
=
map
EX
[
"map :: (a -> b) [a] -> [b]
\n
map f [] = []
\n
map f [x:xs] = [f x:map f xs]"
]
}
bs_generic
=
{
syntax_title
=
"generic function definition"
,
syntax_patterns
=
map
exact
[
"generic"
,
"derive"
,
"of"
,
"
\\
{
\\
|.*
\\
|
\\
}"
]
...
...
@@ -268,6 +293,15 @@ bs_generic =
]
}
bs_hierarchical_modules
=
{
syntax_title
=
"hierarchical module names"
,
syntax_patterns
=
[
exact
"
\\
."
]
,
syntax_code
=
[
"... . ..."
]
,
syntax_description
=
"Modules can be structured hierarchically. For instance, module `Control.Monad` can be found in `Control/Monad.[di]cl`."
,
syntax_doc_locations
=
[]
,
syntax_examples
=
[
EX
"definition module Control.Monad"
]
}
bs_import
=
{
syntax_title
=
"imports"
,
syntax_patterns
=
map
exact
[
"import"
,
"from"
,
"qualified"
,
"as"
,
"=>"
,
"code"
,
"library"
]
...
...
@@ -559,6 +593,30 @@ bs_synonym_abstract =
,
syntax_examples
=
[
EX
":: Stack a (:== [a])"
]
}
bs_type_definition
=
{
syntax_title
=
"type definition"
,
syntax_patterns
=
map
exact
[
"::"
,
"="
,
"
\\
|"
]
,
syntax_code
=
[
":: ..."
]
,
syntax_description
=
"Defines a new type. There are too many possibilities to list hear; see the documentation."
,
syntax_doc_locations
=
[
CLR
7
"5"
"_Toc311798038"
]
,
syntax_examples
=
map
EX
[
join
"
\n\t
"
[
":: Day // An algebraic data type"
,
"= Mon"
,
"| Tue"
,
"| Wed"
,
"| Thu"
,
"| Fri"
,
"| Sat"
,
"| Sun"
]
,
":: Position = // A record type
\n\t
{ x :: Int
\n\t
, y :: Int
\n\t
}"
]
}
bs_type_specification
=
{
syntax_title
=
"type specification"
,
syntax_patterns
=
map
exact
[
"::"
]
,
syntax_code
=
[
"... :: ..."
]
,
syntax_description
=
"Specifies the type of a function."
,
syntax_doc_locations
=
[
CLR
5
"3.7"
"_Toc311798009"
]
,
syntax_examples
=
map
EX
[
"map :: (a -> b) [a] -> [b] // map has arity 2
\n
map f [] = []
\n
map f [x:xs] = [f x:map f xs]"
,
"map :: (a -> b) -> [a] -> [b] // map has arity 1
\n
map f =
\\
xs -> case xs of
\n\t
[] -> []
\n\t
[x:xs] -> [f x:map f xs]"
]
}
bs_unique
=
{
syntax_title
=
"uniqueness annotation"
,
syntax_patterns
=
map
exact
[
"
\\
*"
,
"
\\
."
,
"
\\
w:"
,
"
\\
[.*<=.*
\\
]"
,
","
,
"<="
]
...
...
Write
Preview
Markdown
is supported
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