Die Präsentation wird geladen. Bitte warten

Die Präsentation wird geladen. Bitte warten

Whoami. whoami Tobias FROGGS Slangs sub languages.

Ähnliche Präsentationen


Präsentation zum Thema: "Whoami. whoami Tobias FROGGS Slangs sub languages."—  Präsentation transkript:

1

2 whoami

3 Tobias

4 FROGGS

5 Slangs

6 sub languages

7 syntax?

8 dialect Ein Dialekt (also eine Mundart) ist eine lokale oder regionale Sprachvarietät. Er kann sich von anderen Dialekten wie auch von der Standardsprache in allen Sprachbereichen wie Lautebene (Phonologie), Wortbeugung (Morphologie), Wortschatz (Lexik), Satzbau (Syntax) und Idiomatik – unterscheiden.

9 phonology

10 phonology

11 morphology

12 <foo bar baz>.join

13 morphology

14 lexic

15 use Foo;

16 lexic ✓

17 syntax

18 say do for ^10 -> $x { -$x }
say map { -$_ } 0..9 say map { -$_ }, ^10 say (^10).map: -* say do for ^10 -> $x { -$x }

19 syntax ✓

20 idiomatic

21 sub foo { my %opt = @_ } sub foo( *%opt ) { ... } <?php ... ?>

22 idiomatic ✓

23 phonology morphology lexic ✓ syntax ✓ idiomatic ✓

24 I FORGOT HOW TO SLANG

25 @x = (1, 2, 3); say # „1“ sub foo($) { shift }; say foo 1, 2, 3; # „123“ say # „3“

26 sub postfix:<!>($n) { [+] 1...$n } say 3! # „6“

27 use v6; $*ERR.say: $*OS; { use v5; say STDERR $^O; }

28 use v6; $*ERR.say: $*OS; { use v5; say STDERR $^O; }

29 use v5;

30 shift =~ m=^(((ht|f)tp(s?))\://)? (www.|[a-zA-Z].)
use v5; sub is_valid { shift =~ m=^(((ht|f)tp(s?))\://)? ( [a-zA-Z0-9\-\.]+\.(com)(\:[0-9]+)* (/($|[a-zA-Z0- 9\.\,\;\?\'\\\+&%\ $#\~_\-]+))*$=i } { use 6.0.0; say ?is_valid( “ ) - großes bestehendes Projekt - kleine Snippets die ungern neu geschrieben werden wollen

31 sub decode-json( $json_text ) { use v5; use JSON;
$json = JSON->new->allow_nonref; $json->decode( $json_text ); } - CPAN-Module mit ganz bestimmten Eigenschaften punktuell nutzen

32 use v6; use JSON:from<Perl5>; JSON.new.encode({a => 1})

33 sub decode-json( $json_text ) { use v5; use JSON;
$json = JSON->new->allow_nonref; $json->decode( $json_text ); } - CPAN-Module mit ganz bestimmten Eigenschaften punktuell nutzen

34 sub decode-json( $json_text ) { use v5; use JSON;
$json = JSON->new->allow_nonref; $json->decode( $json_text ); } - CPAN-Module mit ganz bestimmten Eigenschaften punktuell nutzen

35 sub decode-json( $json_text ) { use v5; use JSON;
$json = JSON->new->allow_nonref; $json->decode( $json_text ); } - CPAN-Module mit ganz bestimmten Eigenschaften punktuell nutzen

36 sub decode-json( $json_text ) { use v5; use JSON;
$json = JSON->new->allow_nonref; $json->decode( $json_text ); } - CPAN-Module mit ganz bestimmten Eigenschaften punktuell nutzen

37 token comp_unit { :my $*MAIN := “MAIN“; } token statement_control:sym<use> { :my $OLD_MAIN := ~$*MAIN; <sym> <.ws> [ || <version> || <module_name> <version>? ] [ <?{ $*MAIN ne $OLD_MAIN }> <statementlist=.LANG($*MAIN, 'statementlist')> ]?

38 token comp_unit { :my $*MAIN := “MAIN“; } token statement_control:sym<use> { :my $OLD_MAIN := ~$*MAIN; <sym> <.ws> [ || <version> || <module_name> <version>? ] [ <?{ $*MAIN ne $OLD_MAIN }> <statementlist=.LANG($*MAIN, 'statementlist')> ]?

39 grammar P5::Grammar { token statementlist { <statement>* } } class P5::Actions { method statementlist($/) { for $<statement> { [...] } sub { %*LANG<Perl5> := P5::Grammar; %*LANG<Perl5-actions> := P5::Actions; $*MAIN := “Perl5“;

40 grammar P5::Grammar { token statementlist { <statement>* } } class P5::Actions { method statementlist($/) { for $<statement> { [...] } sub { %*LANG<Perl5> := P5::Grammar; %*LANG<Perl5-actions> := P5::Actions; $*MAIN := “Perl5“;

41 sub decode-json( $json_text ) { use v5; use JSON;
$json = JSON->new->allow_nonref; $json->decode( $json_text ); } - CPAN-Module mit ganz bestimmten Eigenschaften punktuell nutzen

42 Parser?

43 * + 3 $a $b

44 ↓ grammar P5::Grammar { token statementlist { <statement>* }
class P5::Actions { method statementlist($/) { for $<statement> { make .ast }

45 * + 3 $a $b

46 $a + $b * 3

47 Parrot

48 Parrot JVM

49 Parrot JVM MoarVM

50 ?

51 JavaScript

52 * + 3 $a $b

53 call &say &slurp „hello“ $^O ...

54 use v6; my Int $a; say $a; { use v5; }

55 use v6; my Int $a; say $a; # „(Int)“ { use v5; say $a; }

56 use v6; my Int $a; say $a.gist; # „(Int)“ { use v5; say $a; }

57 use v6; my Int $a; say $a.gist; # „(Int)“ { use v5; say $a; # „“ say $a; }

58 use v6; my Int $a; say $a.gist; # „(Int)“ { use v5; &P5say $a; # „“ say $a; }

59 use v6; my Int $a; say $a.gist; # „(Int)“ { use v5; &P5say $a; # „“ say $a; # „(Int)“ }

60 multi P5Str(Mu:U) { P5warn(:cat<uninitialized>, 'Use of uninitialized value in string'); '' } multi P5Str(Bool:D \s) { s ?? 1 !! '' } multi P5Str(Int:D \s) { s.Int } multi P5Str(Num:D \s) { s.Num } multi P5Str(Parcel:D \s) { s.Int } multi P5Str(Sub:D \s) { 'CODE(' ~ s.WHERE.fmt('0x%X').lc ~ ')'

61 multi P5Str(Mu:U) { P5warn(:cat<uninitialized>, 'Use of uninitialized value in string'); '' } multi P5Str(Bool:D \s) { s ?? 1 !! '' } multi P5Str(Int:D \s) { s.Int } multi P5Str(Num:D \s) { s.Num } multi P5Str(Parcel:D \s) { s.Int } multi P5Str(Sub:D \s) { 'CODE(' ~ s.WHERE.fmt('0x%X').lc ~ ')'

62 CORE.setting

63 20799

64 my role Positional { ... } my role Associative { ... } my role Callable { ... } my $!; my $/; my $_; proto infix:<&&>(|) { * } multi infix:<&&>(Mu $x = Bool::True) { $x } multi infix:<&&>(Mu \a, Mu \b) { a && b }

65 Perl5::Terms

66 1459

67 1459..*

68 ?

69 conditions

70 if (EXPR) BLOCK elsif (EXPR) BLOCK ... else BLOCK

71 unless (EXPR) BLOCK elsif (EXPR) BLOCK ... else BLOCK

72 EXPR if EXPR EXPR unless EXPR

73 loops

74 LABEL while (EXPR) BLOCK continue BLOCK
LABEL until (EXPR) BLOCK continue BLOCK

75 LABEL for (EXPR; EXPR; EXPR) BLOCK
LABEL for VAR (LIST) BLOCK continue BLOCK LABEL foreach VAR (LIST) BLOCK continue BLOCK

76 LABEL BLOCK continue BLOCK

77 BEGIN BLOCK

78 use require

79 chdir chr close each int not open ord pack pop pos print
push rand ref say shift splice split substr time unlink unpack unshift

80 * / % x + - . << >> < > <= >= lt gt le ge
** ! ~ \ =~ !~ * / % x << >> < > <= >= lt gt le ge == != <=> eq ne cmp ~~ & | ^ && || // ?: = += -= *= etc. , => not and xor

81 use overlord!

82 use overload;

83 use overload '""' => sub {'('.ref(shift).')'}

84 sub foo($) { }

85 my $bar; sub foo :lvalue { $bar }

86 use vars qw(%foo);

87 use warnings qw(uninitialized);

88 use strict;

89 use Config; use English;

90 use if ($] >= 5.01), strict => 'subs';

91 sub bar { goto &foo; }

92 $str =~ s/ä/ae/g

93 open FH '>', 'foo'

94 new SDL::Rect

95 :o(

96 next LABEL last LABEL redo LABEL

97 goto LABEL

98 say 1, two, 3 # 1two3

99 AnyDBM_File Benchmark Carp

100 never?

101 XS

102 tests

103 8093

104 42906

105 >92000

106 FROGGS usev5.wordpress.com freenode/#perl6 github.com/FROGGS


Herunterladen ppt "Whoami. whoami Tobias FROGGS Slangs sub languages."

Ähnliche Präsentationen


Google-Anzeigen