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
compilerconstruction
ssm
Commits
8b56e644
Commit
8b56e644
authored
Apr 20, 2020
by
Mart Lubbers
Browse files
helpgen
parent
bfbf9ecc
Pipeline
#41648
passed with stage
in 23 seconds
Changes
3
Pipelines
1
Expand all
Show whitespace changes
Inline
Side-by-side
HELP.md
0 → 100644
View file @
8b56e644
This diff is collapsed.
Click to expand it.
README.md
View file @
8b56e644
...
@@ -6,12 +6,11 @@ Download the latest version [here][0]
...
@@ -6,12 +6,11 @@ Download the latest version [here][0]
Simple Stack Machine interpreter
Simple Stack Machine interpreter
Forked from http://www.staff.science.uu.nl/~dijks106/SSM/
Forked from http://www.staff.science.uu.nl/~dijks106/SSM/
(dead link), https://github.com/atzedijkstra/ssm
### Documentation
### Documentation
For now the documentation is available only from within the program and on:
For now the documentation is available only from within the program.
http://www.staff.science.uu.nl/~dijks106/SSM/
### Authors & Contributors
### Authors & Contributors
...
...
genhelp.hs
0 → 100644
View file @
8b56e644
module
Main
where
import
System.Environment
import
System.Exit
import
Data.List
mkGeneral
::
[
Char
]
->
[
Char
]
mkGeneral
file
=
concat
toc
++
concat
(
map
content
items
)
where
toc
=
(
"### Keywords "
++
top
++
"
\n\n
"
)
:
map
(
mkkw
.
fst
)
items
content
(
k
,
v
)
=
"
\n
### "
++
k
++
" "
++
top
++
"
\n\n
"
++
tail
(
repLinks
v
)
++
"
\n
"
items
=
[
span
(
/=
'='
)
l
|
l
<-
lines
file
,
not
$
isPrefixOf
"#"
l
,
not
$
null
l
]
mkInstr
::
[
Char
]
->
[
Char
]
mkInstr
file
=
concat
toc
++
concat
(
map
content
items
)
where
toc
=
(
"### Keywords "
++
top
++
"
\n\n
"
)
:
map
(
mkkw
.
fst
)
items
content
(
k
,
[
descr
,
prepost
,
example
])
=
"
\n\n
### "
++
k
++
" "
++
top
++
"
\n\n
"
++
"#### Description
\n\n
"
++
repLinks
descr
++
if
not
(
null
prepost
)
then
"
\n\n
#### Pre and postconditions
\n\n
"
++
pre
(
repLinks
prepost
)
else
""
++
if
not
(
null
example
)
then
"
\n\n
#### Examples
\n\n
"
++
pre
(
repLinks
example
)
else
""
++
"
\n\n
"
pre
x
=
"```
\n
"
++
commaNewLine
x
++
"
\n
```"
commaNewLine
(
','
:
' '
:
rest
)
=
'
\n
'
:
commaNewLine
rest
commaNewLine
(
x
:
rest
)
=
x
:
commaNewLine
rest
commaNewLine
[]
=
[]
items
=
mkItems
$
splitTopic
[]
$
lines
file
mkItems
(
a
@
[
descr
,
prepost
,
example
]
:
rest
)
=
(
kw
,
map
body
a
)
:
mkItems
rest
where
kw
=
takeWhile
(
/=
'_'
)
descr
body
=
tail
.
dropWhile
(
/=
'='
)
mkItems
(
_
:
xs
)
=
mkItems
xs
mkItems
[]
=
[]
splitTopic
::
[
String
]
->
[
String
]
->
[[
String
]]
splitTopic
acc
[]
=
[
reverse
acc
]
splitTopic
acc
(
[]
:
rest
)
=
reverse
acc
:
splitTopic
[]
rest
splitTopic
acc
(
x
:
rest
)
=
splitTopic
(
x
:
acc
)
rest
repLinks
[]
=
[]
repLinks
(
'@'
:
rest
)
=
let
(
l
,
r
)
=
span
(
/=
' '
)
rest
in
"See "
++
mkkw
l
++
repLinks
(
if
null
r
then
[]
else
tail
r
)
repLinks
(
x
:
xs
)
=
x
:
repLinks
xs
mkkw
::
[
Char
]
->
[
Char
]
mkkw
v
=
concat
[
"["
,
v
,
"](#"
,
v
,
") "
]
top
=
"[⭱](#ssm-help)"
main
=
getArgs
>>=
\
c
->
case
c
of
[
general
,
instr
]
->
putStrLn
"# SSM Help
\n
"
>>
putStrLn
"## Table of Contents
\n
"
>>
putStrLn
"- [General help](#General)"
>>
putStrLn
"- [Instructions help](#Instructions)
\n
"
>>
putStrLn
"## General
\n
"
>>
readFile
general
>>=
putStrLn
.
mkGeneral
>>
putStrLn
"## Instructions
\n
"
>>
readFile
instr
>>=
putStrLn
.
mkInstr
>>
exitWith
ExitSuccess
_
->
putStrLn
(
"Usage: genhelp ssmhelp.prop ssminstrhelp.prop"
)
>>
exitWith
(
ExitFailure
1
)
Mart Lubbers
@mlubbers
mentioned in issue
#1 (closed)
·
Jan 25, 2021
mentioned in issue
#1 (closed)
mentioned in issue #1
Toggle commit list
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