Commit 285c987b authored by Daan Sprenkels's avatar Daan Sprenkels
Browse files

parser: fix typo and fix example SPL programs

parent 05f3716f
Pipeline #1208 passed with stage
......@@ -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 );
......
......@@ -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 ;
......
......@@ -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::LeftBrace);
expect_token!("'}'", self.input, offset, Token::RightBrace);
let while_stmt = WhileStmt {
cond: cond,
......
Supports Markdown
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