Upgrade to Pro — share decks privately, control downloads, hide ads and more …

LittleSmallscript

 LittleSmallscript

LittleSmallscript the language compiles into JavaScript.

http://ympbyc.github.com/LittleSmallscript

Minori Yamashita

November 03, 2012
Tweet

More Decks by Minori Yamashita

Other Decks in Programming

Transcript

  1. LittleSmallscript Little Smalltalk Smalltalk-80 to your terminal http://smalltalk.org/versions/LittleSmalltalk.html ・Minimal ・Subset

    of Smalltalk-80 language ・No graphical VM ・Scopes of instance variables ・Cascade ・Class syntax (v5)
  2. Object subclass:#Animal variables:#(#name). !Animal setName: nm name := nm !.

    !Animal move: metre console log: name + ' moved ' + metre + 'm' !. Animal subclass:#Snake variables:#(). !Snake move console log: 'Slithering...'. Snake super:#move arguments:#(5) !. Snake new; setName:'Sammy the Python'; move
  3. Feature 1. Syntax that is similar to Smalltalk's chunk format

    2. Use Javascript functions and methods ・forEach, $, Object#keys ... 3. Compiles into clean JavaScript ・Human readable ・Easy to fallback to native JS
  4. for (i = 0; i < 5; ++i) { alert(i);

    } while (x < 5) { --x } try {} catch (err) {err}
  5. for (i = 0; i < 5; ++i) { alert(i);

    } while (x < 5) { --x } try {} catch (err) {err}
  6. (0 to:4) do:[:i| alert value:i ] [x < 5] whileTrue:[

    x -= 1 ] [ ] tryCatch:[:err|err]
  7. (0 to:4) do:[:i| alert value:i ] [x < 5] whileTrue:[

    x -= 1 ] [ ] tryCatch:[:err|err]