Skip to content
Browse files

start to document terms

  • Loading branch information...
1 parent 8759962 commit 7ea682f0edf0b7cae7e4b291a8c9962717d9ea2f @moritz moritz committed Sep 4, 2012
Showing with 96 additions and 0 deletions.
  1. +96 −0 lib/terms.pod
96 lib/terms.pod
@@ -0,0 +1,96 @@
+=begin pod
+=TITLE Terms
+Most syntactic constructs in Perl 6 can be categorized in I<terms> and
+Here you can find an overview of different kinds of terms.
+=head1 Literals
+=head2 Int
+ 42
+ 12_300_00
+ :16<DEAD_BEEF>
+L<Int> literals consist of digits, and can contain underscores
+between any two digits.
+To specify a base other than ten, use the colonpair form C<< :radix<number> >>.
+=head2 Rat
+ 12.34
+ 1_200.345_678
+L<Rat> (rational numbers) literals contain two integer parts joined by a dot.
+Note that trailing dots are not allowed, so you have to write C<1.0> instead
+of C<1.> (this rule is important because there are infix operators starting
+with a dot, for example the C<..> L<Range> operator).
+=head2 Num
+ 12.3e-32
+ 3e8
+L<Num> (floating point numbers) literals consist of L<Rat> or L<Int> literals
+followed by an C<e> and a (possibly negative) exponent. C<3e8> constructs a
+L<Num> with value C<3 * 10**8>.
+=head2 Str
+see the section on quoting constructs below.
+=head2 Regex
+see the section on quoting constructs below.
+=head2 Pair
+ a => 1
+ 'a' => 'b'
+ :identifier
+ :!identifier
+ :identifier<value>
+ :identifier<value1 value2>
+ :identifer($value)
+ :identifer['val1', 'val2']
+ :identifier{key1 => 'val1', key2 => 'value2'}
+ :$item
+ :@array
+ :%hash
+ :&callable
+L<Pair> objects can be created either with C<< infix:«=>» >> (which
+auto-quotes the left-hand side if it is an identifier), or with the various
+colonpair forms. Those always start with a colon, and then are followed either
+by an identifier or the name of an already existing varible (whose name sans
+the sigil is used as the key, and value of the variable is used as the value
+of the pair).
+In the identifier form a colonpair, the optional value can be any circumfix.
+If it is left blank, the value is C<Bool::True>. The value of the
+C<:!identifier> form is C<Bool::False>.
+If used in an argument list, all of these forms count as named arguments, with
+the exception of C<< 'quoted string' => $value >>.
+=head2 Parcel
+ ()
+ 1, 2, 3
+ <a b c>
+ «a b c»
+ qw/a b c/
+L<Parcel> literals are: the empty pair of parens C<()>, a comma-separated
+list, or several quoting constructs
+=head1 Quoting constructs
+=end pod

0 comments on commit 7ea682f

Please sign in to comment.
Something went wrong with that request. Please try again.