Splaf  Check-in [b0380d17ef]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Added alternative functions for I/O ("ler" and "escrever").
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:b0380d17ef479d44b26a6dcc8ce07e0e4caf004e
User & Date: emanuel.angelo@gmail.com 2012-10-16 19:24:53
Context
2012-10-16
19:41
Added square root function. check-in: 2ef952be95 user: emanuel.angelo@gmail.com tags: trunk
19:24
Added alternative functions for I/O ("ler" and "escrever"). check-in: b0380d17ef user: emanuel.angelo@gmail.com tags: trunk
2012-10-09
23:37
Added boolean variables and statements. check-in: 21cd97d6f6 user: emanuel.angelo@gmail.com tags: trunk
Changes

Changes to .todo.done.

2
3
4
5
6
7
8

9
Add >=, <=, ==, logical AND, OR and NOT to the grammar | id:274f8bc44e3e6ee7b161d4b522dee61149449e83
Implement parser | id:555828ffa4e59f1ea30d47ace4993ff44475804a
Flowchart automatic construction from the structured language | id:765757bbdeb83d6200c099b9fa756b2323df467c
Saving to server | id:90cc94f0b58513cf08bba408ec8f70ca4585cdaf
Implement the if statement in the interpreter | id:9633335540f23eddbf08018bd7dfb5487c16ff9c
Loading from server | id:9863ee827ab9625d9a0716f03076ee4d3fec613d
Optimize parser by getting rid of scopes | id:af510b25ed70685884d69869eb4c0ccb7334b2b1

Implement interpreter | id:f2d35003e89eaf78ecfd7d0acc6b782cebcd2396







>

2
3
4
5
6
7
8
9
10
Add >=, <=, ==, logical AND, OR and NOT to the grammar | id:274f8bc44e3e6ee7b161d4b522dee61149449e83
Implement parser | id:555828ffa4e59f1ea30d47ace4993ff44475804a
Flowchart automatic construction from the structured language | id:765757bbdeb83d6200c099b9fa756b2323df467c
Saving to server | id:90cc94f0b58513cf08bba408ec8f70ca4585cdaf
Implement the if statement in the interpreter | id:9633335540f23eddbf08018bd7dfb5487c16ff9c
Loading from server | id:9863ee827ab9625d9a0716f03076ee4d3fec613d
Optimize parser by getting rid of scopes | id:af510b25ed70685884d69869eb4c0ccb7334b2b1
Add alternative functions for I/O ("ler" and "escrever"). | id:e058eb5693c76cf293e91b5a4b0507da1ea62bb1
Implement interpreter | id:f2d35003e89eaf78ecfd7d0acc6b782cebcd2396

Changes to bugs.

1

2
Graphical representation of unary operators is missing. | id:7e2b02d1b93b0ed875f9123b6017dd893c497c72

Manual input and terminal output are both wrongly represented as I/O | id:cce960fd58f8dfaad165942bc8ecb416c0bfdd9c

>

1
2
3
Graphical representation of unary operators is missing. | id:7e2b02d1b93b0ed875f9123b6017dd893c497c72
Values like 1.02 are transformed into 1.2 (zeroes between the decimal point and the rest of the digits to the right are removed). | id:a3ec71c347f725d3e23f0ba6d915e3588fc7e6a4
Manual input and terminal output are both wrongly represented as I/O | id:cce960fd58f8dfaad165942bc8ecb416c0bfdd9c

Changes to grammars/pt.grammar.

19
20
21
22
23
24
25


26
27
28
29
30
31
32
...
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
        value: val 
      } 
    }

functionname "nome de função"
  = "diz"
  / "enquanto"


  / "pede"
  / "se"

reserved "reservado"
  = functionname
  / "começa"
  / "e"
................................................................................
        type: "while",
        condition: cond,
        value: whileval
      }
    }

prompt "pedido"
  = "pede" ws+ id:identifiername _ lb {
      return {
        type: "prompt",
        name: id
      }
    }

print "apresentação"
  = "diz" ws+ args:((ws? ComparisonExpression)+)? _ lb {
      return {
        type: "print",
        arguments: args ? args.map(function(a) { return a[1] }) : null
      }
    }

ws "um espaço em branco"







>
>







 







|







|







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
...
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
        value: val 
      } 
    }

functionname "nome de função"
  = "diz"
  / "enquanto"
  / "escrever"
  / "ler"
  / "pede"
  / "se"

reserved "reservado"
  = functionname
  / "começa"
  / "e"
................................................................................
        type: "while",
        condition: cond,
        value: whileval
      }
    }

prompt "pedido"
  = ("pede" / "ler") ws+ id:identifiername _ lb {
      return {
        type: "prompt",
        name: id
      }
    }

print "apresentação"
  = ("diz" / "escrever") ws+ args:((ws? ComparisonExpression)+)? _ lb {
      return {
        type: "print",
        arguments: args ? args.map(function(a) { return a[1] }) : null
      }
    }

ws "um espaço em branco"

Changes to parser.js.

295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311




















312
313
314
315
316
317
318


319
320
321
322
323
324
325
....
2270
2271
2272
2273
2274
2275
2276











2277
2278
2279
2280
2281
2282
2283
....
2343
2344
2345
2346
2347
2348
2349











2350
2351
2352
2353
2354
2355
2356
....
2640
2641
2642
2643
2644
2645
2646

          } else {
            result0 = null;
            if (reportFailures === 0) {
              matchFailed("\"enquanto\"");
            }
          }
          if (result0 === null) {
            if (input.substr(pos, 4) === "pede") {
              result0 = "pede";
              pos += 4;
            } else {
              result0 = null;
              if (reportFailures === 0) {
                matchFailed("\"pede\"");
              }
            }
            if (result0 === null) {




















              if (input.substr(pos, 2) === "se") {
                result0 = "se";
                pos += 2;
              } else {
                result0 = null;
                if (reportFailures === 0) {
                  matchFailed("\"se\"");


                }
              }
            }
          }
        }
        reportFailures--;
        if (reportFailures === 0 && result0 === null) {
................................................................................
          result0 = "pede";
          pos += 4;
        } else {
          result0 = null;
          if (reportFailures === 0) {
            matchFailed("\"pede\"");
          }











        }
        if (result0 !== null) {
          result2 = parse_ws();
          if (result2 !== null) {
            result1 = [];
            while (result2 !== null) {
              result1.push(result2);
................................................................................
          result0 = "diz";
          pos += 3;
        } else {
          result0 = null;
          if (reportFailures === 0) {
            matchFailed("\"diz\"");
          }











        }
        if (result0 !== null) {
          result2 = parse_ws();
          if (result2 !== null) {
            result1 = [];
            while (result2 !== null) {
              result1.push(result2);
................................................................................
    this.column = column;
  };
  
  result.SyntaxError.prototype = Error.prototype;
  
  return result;
})();








|
|
|



|



>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
>
>







 







>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>







 







>
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
....
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
....
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
....
2684
2685
2686
2687
2688
2689
2690
2691
          } else {
            result0 = null;
            if (reportFailures === 0) {
              matchFailed("\"enquanto\"");
            }
          }
          if (result0 === null) {
            if (input.substr(pos, 8) === "escrever") {
              result0 = "escrever";
              pos += 8;
            } else {
              result0 = null;
              if (reportFailures === 0) {
                matchFailed("\"escrever\"");
              }
            }
            if (result0 === null) {
              if (input.substr(pos, 3) === "ler") {
                result0 = "ler";
                pos += 3;
              } else {
                result0 = null;
                if (reportFailures === 0) {
                  matchFailed("\"ler\"");
                }
              }
              if (result0 === null) {
                if (input.substr(pos, 4) === "pede") {
                  result0 = "pede";
                  pos += 4;
                } else {
                  result0 = null;
                  if (reportFailures === 0) {
                    matchFailed("\"pede\"");
                  }
                }
                if (result0 === null) {
                  if (input.substr(pos, 2) === "se") {
                    result0 = "se";
                    pos += 2;
                  } else {
                    result0 = null;
                    if (reportFailures === 0) {
                      matchFailed("\"se\"");
                    }
                  }
                }
              }
            }
          }
        }
        reportFailures--;
        if (reportFailures === 0 && result0 === null) {
................................................................................
          result0 = "pede";
          pos += 4;
        } else {
          result0 = null;
          if (reportFailures === 0) {
            matchFailed("\"pede\"");
          }
        }
        if (result0 === null) {
          if (input.substr(pos, 3) === "ler") {
            result0 = "ler";
            pos += 3;
          } else {
            result0 = null;
            if (reportFailures === 0) {
              matchFailed("\"ler\"");
            }
          }
        }
        if (result0 !== null) {
          result2 = parse_ws();
          if (result2 !== null) {
            result1 = [];
            while (result2 !== null) {
              result1.push(result2);
................................................................................
          result0 = "diz";
          pos += 3;
        } else {
          result0 = null;
          if (reportFailures === 0) {
            matchFailed("\"diz\"");
          }
        }
        if (result0 === null) {
          if (input.substr(pos, 8) === "escrever") {
            result0 = "escrever";
            pos += 8;
          } else {
            result0 = null;
            if (reportFailures === 0) {
              matchFailed("\"escrever\"");
            }
          }
        }
        if (result0 !== null) {
          result2 = parse_ws();
          if (result2 !== null) {
            result1 = [];
            while (result2 !== null) {
              result1.push(result2);
................................................................................
    this.column = column;
  };
  
  result.SyntaxError.prototype = Error.prototype;
  
  return result;
})();

Changes to todo.

1
2
3
4
5
6
7

8
Implement addEventListener with jQuery | id:198c5890a8c7b8d3ec69fc4f52485bc29d937b98
Convert verbose operators into compact ones in the flowchart. | id:282849e19d7c03287572c6ae311de1c1befd9dd7
Verify if source code was modified and warn user on actions that will discard those modifications | id:3bcb598ee0495084dd3881c550fee2e9099637d1
Flowchart editing infrastructure | id:4fd44559f6ef158c5652620ef58259427335578a
Structured language automatic writing from the flowchart editing actions | id:70c70f55ad67c1d3b305d21c30da459b18fa509a
Add arrows to connection lines | id:a21b2d395b3a9f155805347576f4974559618312
Use indentation to define blocks of statements. | id:c6e1342a5193a60399f945977b5482e30f14bba4

jQuerify the saveFile function in splaf.js | id:f0ae11338c032544edcfa32768321498262c7328







>

1
2
3
4
5
6
7
8
9
Implement addEventListener with jQuery | id:198c5890a8c7b8d3ec69fc4f52485bc29d937b98
Convert verbose operators into compact ones in the flowchart. | id:282849e19d7c03287572c6ae311de1c1befd9dd7
Verify if source code was modified and warn user on actions that will discard those modifications | id:3bcb598ee0495084dd3881c550fee2e9099637d1
Flowchart editing infrastructure | id:4fd44559f6ef158c5652620ef58259427335578a
Structured language automatic writing from the flowchart editing actions | id:70c70f55ad67c1d3b305d21c30da459b18fa509a
Add arrows to connection lines | id:a21b2d395b3a9f155805347576f4974559618312
Use indentation to define blocks of statements. | id:c6e1342a5193a60399f945977b5482e30f14bba4
Add function to calculate square root. | id:c86d8826f4917c7f3b901e91e3841208bc7ca333
jQuerify the saveFile function in splaf.js | id:f0ae11338c032544edcfa32768321498262c7328