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
Daan Sprenkels
rsplt
Commits
285c987b
Commit
285c987b
authored
Mar 15, 2016
by
Daan Sprenkels
Browse files
parser: fix typo and fix example SPL programs
parent
05f3716f
Pipeline
#1208
passed with stage
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
spl/facR.spl
View file @
285c987b
...
...
@@ -3,7 +3,7 @@ Three ways to implement the factorial function in SPL.
First the recursive version .
*/
facR ( n ) :: Int -> Int {
if ( n
=
2 ) {
if ( n
<
2 ) {
return 1;
} else {
return n * facR ( n - 1 );
...
...
spl/main.spl
View file @
285c987b
...
...
@@ -3,7 +3,7 @@ main ( blah ) :: Void {
var facN = 1 ;
var ok = True;
while ( n < 20 ) {
facN = facR ( n ;
facN = facR ( n
)
;
if ( facN != facI ( n ) || facN != facL ( n )) {
print ( n : facN : facI ( n ) : facL ( n ) : [] ) ;
ok = False ;
...
...
src/parser.rs
View file @
285c987b
...
...
@@ -480,7 +480,7 @@ impl Parser {
expect_token!
(
"'{'"
,
self
.input
,
offset
,
Token
::
LeftBrace
);
let
(
body
,
mut
offset
)
=
try_parse!
(
self
.parse_stmts
(
offset
,
Vec
::
new
()));
let
&
TokenAndSpan
(
_
,
Span
{
start
:
_
,
mut
end
})
=
expect_token!
(
"'}'"
,
self
.input
,
offset
,
Token
::
Lef
tBrace
);
expect_token!
(
"'}'"
,
self
.input
,
offset
,
Token
::
Righ
tBrace
);
let
while_stmt
=
WhileStmt
{
cond
:
cond
,
...
...
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