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

Saffire introduction

Saffire introduction

An introduction on Saffire - the new programming language

Joshua Thijssen

August 19, 2012
Tweet

More Decks by Joshua Thijssen

Other Decks in Technology

Transcript

  1. Saffire Goals • Be a (not the) programming language. •

    Suitable for web (fastCGI) and command line. • “best of all programming worlds”.
  2. History • Joshua Thijssen decided on learning more about flex

    / bison. • “Why not write a language instead of a calculator?” • 2 hours later: 2 developers, a github account and domains registered. • Saffire, dutch/english mix of “saphire” (as in: perl / ruby / ...).
  3. History • Primarily based on PHP / Python syntax with

    some ideas from other languages (java, ruby, javascript). • We’re 10-15 years behind, but 10-15 years of traps and pitfalls we can avoid.
  4. Technical info • Open source (3-clause BSD license). • Written

    in C. • Imperative language. • Dynamically and strong typed. • Byte code generation. • Interpreter for now. • JIT (and/or compilation) later.
  5. Selling points • Everything is an object. • Even “foo”,

    2, /reg?ex*/ and 3.14159265. • UTF-8 out of the box. • No functions, just objects and methods. • Method and operator overloading.
  6. Variables and such use io; $a = 1; $b =

    “foo”.length(); // 3 $c = “björk”.length(); // 5! $d = “björk”.bytes().length(); // 6! $e = 1; io.print(“$e equals “,$e);
  7. Classes use io; class Foo { const PI = 3.1415;

    protected property $a = 1; public method ctor() { io.printf(“Constructor called!\n”); } public method dtor() { io.printf(“Destructor called!\n”); } public method Bar() { self.$a++; } } $f = Foo(); io.printf(“PI is “, Foo.PI); io.printf(“First call: “, $f.bar()); io.printf(“Second call: “, $f.bar()); $f.destroy(); // $f is no more
  8. Modules use io; use FooFramework as Foo; use BarFramework; $foo

    = Foo::Framework(); $content = $foo->run(); $req = BarFramework::HTTP::Request(); $req.status = 200; $req.content = $content; $req.out();
  9. Overloading use io; class Foo { protected $a; method ctor(String

    $a) { self.$a = $a; } method ::+(String $b) { return self.$a.concat(“ “, $b); } } $f = Foo(“hello”); $f += “world”; io.printf($f, “\n”);
  10. Current Status • Initial lexing / parsing done. • Language

    specification on its way. • Still figuring out problems. • Abstract Syntax Trees (AST) can be generated.
  11. What’s next • Finish the language specification. • Bytecode optimization

    phase (?) • Create the interpreter. • Create a more stable lex / parse system. • ??? • Profit
  12. Stable release? • Depends on the help! • Not until

    somewhere (late) 2013. • Roadmap hasn’t been created.
  13. We need YOU... • C programmers, but many, many others

    for websites, documentation, language specification, testing/QA, app writers, framework writers, evangelists, etc, etc.. • USERBASE! • If you can read this, you can help us!
  14. Find us! • IRC: freenode.org #saffire • mailinglist: https://groups.google.com/group/ saffire-internals

    • website: http://saffire-lang.org • github: https://github.com/saffire/saffire • twitter: @saffire-lang