Pike UppLYSning - PowerPoint PPT Presentation

1 / 35
About This Presentation
Title:

Pike UppLYSning

Description:

Runtime type checking (pike rt) Soft casts. int(0..30) y = fac(x) ... Less modules than some bigger languages. More Information. pike.ida.liu.se ... – PowerPoint PPT presentation

Number of Views:48
Avg rating:3.0/5.0
Slides: 36
Provided by: martinn
Category:
Tags: upplysning | pike

less

Transcript and Presenter's Notes

Title: Pike UppLYSning


1
Pike UppLYSning
  • nilsson_at_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?yz

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 lt, gt, , lt, gt, !
  • 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 , -, , , , -gt, a
  • m_delete, indices, values
  • foreach(m string index int value)

21
arrays
  • Operators , -, , ,
  • Index operators a, a..b
  • Aggregate operators -gt, ()
  • Splice operator _at_

22
Array mappings
  • map(words, sizeof)
  • sizeof(words)
  • map(words, , \n)
  • words\n
  • row1row2

23
multiset
  • Unordered array
  • multiset primes (lt 1, 2, 3, 5, 7, 11 gt)

24
Funktions
  • int square(int x)
  • return xx
  • int add(int first, int rest)
  • return ( first, _at_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 (intfloat)
  • Specified variable types (int(0..1))

27
Specified types
  • object(Stdio.File) Stdio.File
  • array(intstring)
  • function(int, voidstring void)
  • array(mapping(stringint(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
Write a Comment
User Comments (0)
About PowerShow.com