1 / 35

Pike UppLYSning

Pike UppLYSning. nilsson@pike.ida.liu.se. Short History. LPC µLPC Cendio Roxen IS pelab. Evolved language. Pragmatic Lack of basic features Many complex/powerful features Skewed feature focus. Commercially Driven. Shorter development time Failure prevention measures

zorion
Download Presentation

Pike UppLYSning

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Pike UppLYSning nilsson@pike.ida.liu.se

  2. Short History • LPC • µLPC • Cendio • Roxen IS • pelab

  3. Evolved language • Pragmatic • Lack of basic features • Many complex/powerful features • Skewed feature focus

  4. Commercially Driven • Shorter development time • Failure prevention measures • Wide platform/system support • Skewed feature focus

  5. Focus • Bitmap graphics • Text processing • Network • Database

  6. Pike vs. Other Languages • C • Java • LISP • Python • C#

  7. Source Code • du –hs : 27M • find . | wc -l : 2680 • cvs annotate | wc -l : 610372 • Aprox. Development cost: $1 million

  8. Hello world int main(int argc, array argv) { write(“Hello world!\n”); return 0; }

  9. Programming Paradigms • Imperative • Functional • Object Oriented

  10. Imperative Programming • Program blocks (if, for, while, case) • Case fall through • Labeled breaks • Symbol scopes (lexical closure) • x,y;

  11. Functional Programming • Recursion • Well defined execution order a = x() || y(); i = i++; • Infix operators are functions `+(1,2,3) • x?y:z

  12. OO-programming • Multiple inheritance • Named inheritance • Operator overloading • Modifiers • Type comparisons are done according to the implements-principle (looks-like). • All programs are objects

  13. Hello world, again void create() { write(“Hello world!\n”); exit(0); }

  14. Code environment • C-like syntax • White space insensitive • CPP-like preprocessor • Version management • Symbols may use Unicode-characters.

  15. Coding environment • Emacs cc-mode & font-lock-mode supports Pike. • Incremental Pike front end (Hilfe) • Unused unbug

  16. Datatyper

  17. float • IEEE float-simulation • NaN, Inf • Special compilation needed for double precision.

  18. int • Arithmetic: +, -, *, /, % • Bitwise: |, &, ^, ~ • Logical: <, >, ==, <=, >=, ! • 0 is false • Pike has no maxint.

  19. string string a = “hello \n \” \007 \x4711 world”; string b = #”Line one and line two”; • Shared strings • Character range -0x80000000 – 0x7fffffff • Operators: +, -, *, /, %, |, &, ^ • Index operators: [a], [a..b]

  20. mapping ([ “a” : 12, “b” : 22, “c” : 18 ]) • Operators: +, -, |, &, ^, ->, [a] • m_delete, indices, values • foreach(m; string index; int value)

  21. arrays • Operators: +, -, &, |, ^ • Index operators: [a], [a..b] • Aggregate operators: ->, () • Splice operator: @

  22. Array mappings • map(words, sizeof); • sizeof(words[*]); • map(words, `+, “\n”); • words[*]+”\n”; • row1[*]+row2[*]

  23. multiset • Unordered array • multiset primes = (< 1, 2, 3, 5, 7, 11 >);

  24. Funktions int square(int x) { return x*x; } int add(int first, int … rest) { return `+( first, @rest ); }

  25. Programs class A { int a; void create(int _a) { a = _a; } } class A (int a) { }

  26. Variabeltyper • Untyped variables (mixed) • Simple variable types (int) • Complex variable types (int|float) • Specified variable types (int(0..1))

  27. Specified types • object(Stdio.File) = Stdio.File • array(int|string) • function(int, void|string : void) • array(mapping(string:int(0..127))|float)

  28. Strict Types • Strict types (#pragma strict_types) • Runtime type checking (pike –rt) • Soft casts int(0..30) y = fac(x); int(0..30) y = [int(0..30)]fac(x);

  29. Casts

  30. Memory Management • Automatic & adaptive • Reference count • Advanced GC • Cyclic references • Weak references • Reference creation during destruction

  31. Optimizations • Tree optimization • Strength reduction • Tail recursion • Peephole optimization • Native machine code generation

  32. Benchmark

  33. Why? • Easy to learn (C/Java resemblance) • Powerful data types • Competitive speed and functionality • Bug-suppressing • UNIX-like abstraction • “clean” code

  34. Why not? • Non-standard language • Less support/knowledge/documentation • Less modules than some bigger languages

  35. More Information • pike.ida.liu.se

More Related