Ticket #215: book_cage_clean.patch
File book_cage_clean.patch, 15.9 KB (added by mikehh, 13 years ago) |
---|
-
docs/book/ch02_getting_started.pod
142 142 143 143 =head1 Building Parrot 144 144 145 Z<CHP- 9-SECT-1>145 Z<CHP-2-SECT-2.2.2> 146 146 147 147 X<Parrot;source code> 148 148 The first step before you start playing with Parrot's PASM and PIR … … 192 192 193 193 =head3 Patch submission 194 194 195 Z<CHP-2-SECT-2.2. 2>195 Z<CHP-2-SECT-2.2.3> 196 196 197 197 X<Parrot;patch submission> 198 198 Parrot development proceeds through a continuous stream of patches. … … 324 324 325 325 =head3 Bug tracking 326 326 327 Z<CHP-2-SECT-2.2. 3>327 Z<CHP-2-SECT-2.2.4> 328 328 329 329 X<Parrot;bug tracking> 330 330 Bug reports go to the same address as patch submissions -
docs/book/ch08_architecture.pod
2 2 3 3 =head0 Parrot Internals 4 4 5 Z<CHP- 7>5 Z<CHP-8> 6 6 7 7 This chapter details the architecture and internal workings of Parrot, 8 8 and attempts to explain how Parrot has been designed and how it operates. … … 13 13 14 14 =head1 Core Design Principles 15 15 16 Z<CHP- 7-SECT-1>16 Z<CHP-8-SECT-1> 17 17 18 18 X<Parrot;internals> 19 19 Three main principles drive the design of … … 72 72 73 73 =head1 Parrot's Architecture 74 74 75 Z<CHP- 7-SECT-2>75 Z<CHP-8-SECT-2> 76 76 77 77 The X<architecture;Parrot> 78 78 X<Parrot;architecture> … … 85 85 86 86 =begin figure Parrot's flow 87 87 88 Z<CHP- 7-FIG-1>88 Z<CHP-8-FIG-1> 89 89 F<figs/p6e_0801.png> 90 90 91 91 =end figure … … 113 113 114 114 =head2 Parser 115 115 116 Z<CHP- 7-SECT-2.1>116 Z<CHP-8-SECT-2.1> 117 117 118 118 X<parser, Parrot> 119 119 X<Parrot;parser module> … … 171 171 172 172 =head2 Compiler 173 173 174 Z<CHP- 7-SECT-2.2>174 Z<CHP-8-SECT-2.2> 175 175 176 176 177 177 X<Parrot;compiler module> … … 194 194 195 195 =head2 Optimizer 196 196 197 Z<CHP- 7-SECT-2.3>197 Z<CHP-8-SECT-2.3> 198 198 199 199 X<Parrot;optimizer module> 200 200 X<optimizer> … … 316 316 317 317 =head1 The Interpreter 318 318 319 Z<CHP- 7-SECT-3>319 Z<CHP-8-SECT-3> 320 320 321 321 The X<interpreter, Parrot> 322 322 interpreter is the engine that actually runs the code emitted by the … … 360 360 361 361 =head2 Registers 362 362 363 Z<CHP- 7-SECT-3.1>363 Z<CHP-8-SECT-3.1> 364 364 365 365 X<interpreter, Parrot;registers> 366 366 As we've seen in previous chapers, Parrot has four basic types of … … 375 375 376 376 =head2 Strings 377 377 378 Z<CHP- 7-SECT-3.3>378 Z<CHP-8-SECT-3.3> 379 379 380 380 X<strings;Parrot> 381 381 X<interpreter, Parrot;strings> … … 455 455 456 456 =head2 Variables 457 457 458 Z<CHP- 7-SECT-3.4>458 Z<CHP-8-SECT-3.4> 459 459 460 460 X<variables;Parrot interpreter and> 461 461 X<interpreter, Parrot;variables> … … 506 506 507 507 =head2 Bytecode 508 508 509 Z<CHP- 7-SECT-3.5>509 Z<CHP-8-SECT-3.5> 510 510 511 511 Like any CPU, software, or hardware, Parrot needs a set of 512 512 instructions to tell it what to do. For hardware, this is a stream of … … 560 560 561 561 =head1 I/O, Events, and Threads 562 562 563 Z<CHP- 7-SECT-4>563 Z<CHP-8-SECT-4> 564 564 565 565 Parrot has comprehensive support for I/O, threads, and events. These 566 566 three systems are interrelated, so we'll treat them together. The … … 570 570 571 571 =head2 I/O 572 572 573 Z<CHP- 7-SECT-4.1>573 Z<CHP-8-SECT-4.1> 574 574 575 575 Parrot's base X<I/O;Parrot> I/O system is fully X<asynchronous I/O> 576 576 asynchronous with callbacks and per-request private data. Since this … … 637 637 638 638 =head2 Events 639 639 640 Z<CHP- 7-SECT-4.2>640 Z<CHP-8-SECT-4.2> 641 641 642 642 An X<events, Parrot> event is a notification that something has 643 643 happened: the user has manipulated a GUI element, an I/O request has … … 710 710 711 711 =head2 Signals 712 712 713 Z<CHP- 7-SECT-4.3>713 Z<CHP-8-SECT-4.3> 714 714 715 715 X<signals, Parrot> 716 716 Signals are a special form of event, based on the standard Unix signal … … 771 771 772 772 =head2 Threads 773 773 774 Z<CHP- 7-SECT-4.4>774 Z<CHP-8-SECT-4.4> 775 775 776 776 X<threads, Parrot> 777 777 Threads are a means of splitting a process into multiple pieces that … … 884 884 885 885 =head1 Objects 886 886 887 Z<CHP- 7-SECT-5>887 Z<CHP-8-SECT-5> 888 888 889 889 X<objects;Parrot> 890 890 Perl 5, Perl 6, Python, and Ruby are all object-oriented languages in … … 899 899 900 900 =head2 Generic Object Interfacing 901 901 902 Z<CHP- 7-SECT-5.1>902 Z<CHP-8-SECT-5.1> 903 903 904 904 X<PMCs (Parrot Magic Cookies);handling method calls> 905 905 Parrot's object system is very simple--in fact, a PMC only has to handle … … 924 924 925 925 =head2 Parrot Objects 926 926 927 Z<CHP- 7-SECT-5.2>927 Z<CHP-8-SECT-5.2> 928 928 929 929 X<objects;Parrot> 930 930 X<Parrot;objects> … … 986 986 987 987 =head2 Mixed Class-Type Support 988 988 989 Z<CHP- 7-SECT-5.3>989 Z<CHP-8-SECT-5.3> 990 990 991 991 X<mixed class-type support in Parrot> 992 992 X<classes;Parrot;mixed class support> … … 1015 1015 1016 1016 =head1 Advanced Features 1017 1017 1018 Z<CHP- 7-SECT-6>1018 Z<CHP-8-SECT-6> 1019 1019 1020 1020 Since the languages Parrot targets (like Perl and Ruby) have 1021 1021 sophisticated concepts as core features, it's in Parrot's best … … 1024 1024 1025 1025 =head2 Garbage Collection 1026 1026 1027 Z<CHP- 7-SECT-6.1>1027 Z<CHP-8-SECT-6.1> 1028 1028 1029 1029 X<garbage collection;Parrot> 1030 1030 It's expected that modern languages have garbage collection built in. … … 1099 1099 1100 1100 =head2 Multimethod Dispatching 1101 1101 1102 Z<CHP- 7-SECT-6.2>1102 Z<CHP-8-SECT-6.2> 1103 1103 1104 1104 X<multimethod;dispatching> 1105 1105 Multimethod dispatching (also known as signature-based dispatching) is … … 1162 1162 1163 1163 =head2 Continuations 1164 1164 1165 Z<CHP- 7-SECT-6.3>1165 Z<CHP-8-SECT-6.3> 1166 1166 1167 1167 X<continuations> 1168 1168 Continuations are possibly the most powerful high-level flow control … … 1234 1234 1235 1235 =head2 Coroutines 1236 1236 1237 Z<CHP- 7-SECT-6.4>1237 Z<CHP-8-SECT-6.4> 1238 1238 1239 1239 X<coroutines> 1240 1240 A coroutine is a subroutine or method that can suspend itself partway … … 1256 1256 1257 1257 =head1 Conclusion 1258 1258 1259 Z<CHP- 7-SECT-7>1259 Z<CHP-8-SECT-7> 1260 1260 1261 1261 We've touched on much of Parrot's core functionality, but certainly 1262 1262 not all. Hopefully we've given you enough of a feel for how Parrot -
docs/book/ch12_opcodes.pod
2 2 3 3 =head1 Opcodes and Runcores 4 4 5 Z<CHP-1 1>5 Z<CHP-12> 6 6 7 7 The smallest executable component is not the compilation unit or even 8 8 the subroutine, but is actually the opcode. Opcodes in PASM, like opcodes … … 50 50 51 51 =over 4 52 52 53 =item * Slow Core53 =item * Slow Core 54 54 55 55 The slow core is a basic runcore design that treats each opcode as a 56 56 separate function at the C level. Each function is called, and returns … … 71 71 UPDATE_INTERPRETER(); 72 72 } 73 73 74 =item * Fast Core74 =item * Fast Core 75 75 76 76 The fast core is a bare-bones core that doesn't do any of the 77 77 bounds-checking or context updating that the slow core does. The fast … … 86 86 DISPATCH_OPCODE(pc); 87 87 } 88 88 89 =item * Switch Core89 =item * Switch Core 90 90 91 91 As its name implies, the switch core uses a gigantic C C<switch / case> 92 92 structure to execute opcodes. Here's a brief example of how this … … 109 109 pointer, dereferencing the opcode pointer, and then a jump to the C<case> 110 110 statement for the next opcode. 111 111 112 =item * Computed Goto Core112 =item * Computed Goto Core 113 113 114 114 I<Computed Goto> is a feature of some C compilers where a label is 115 115 treated as a piece of data that can be stored as a C<void *> pointer. Each … … 167 167 presented here. However, as we shall see with the precomputed goto core, 168 168 it isn't optimized as aggressively as is possible. 169 169 170 =item * Precomputed Goto Core170 =item * Precomputed Goto Core 171 171 172 172 The precomputed goto core is an amazingly fast optimized core that uses 173 173 the same computed goto feature, but performs the array dereferencing … … 208 208 available with compilers that support computed goto, such as GCC. Parrot 209 209 will not have access to this core if it is built with a different compiler. 210 210 211 =item * Tracing Core211 =item * Tracing Core 212 212 213 =item * Profiling Core213 =item * Profiling Core 214 214 215 215 The profiling core analyzes the performance of Parrot, and helps to 216 216 determine where bottlenecks and trouble spots are in the programs that … … 227 227 number of calls to each subroutine made. All this information is helpfully 228 228 printed to the STDERR output for later analysis. 229 229 230 =item * GC Debug Core230 =item * GC Debug Core 231 231 232 232 Parrot's garbage collector has been known as a weakness in the system 233 233 for several years. In fact, the garbage collector and memory management … … 243 243 performance is terrible, but that's not the point: it's almost guaranteed 244 244 to find problems in the memory system if they exist. 245 245 246 =item * Debug Core246 =item * Debug Core 247 247 248 248 The debug core works like a normal software debugger, such as GDB. The 249 249 debug core executes each opcode, and then prompts the user to enter a … … 361 361 362 362 =head2 Dynops 363 363 364 =cut 364 365 365 366 ########################################################################## 366 367 # PSEUDOPOD LEGEND -
docs/book/ch09_pct.pod
55 55 56 56 =over 4 57 57 58 =item * A main file58 =item * A main file 59 59 60 60 The main file should contain the C<:main> function that is the driver 61 61 program for the compiler. Here, a new C<PCT::HLLCompiler> object is … … 64 64 although thankfully they tend to be very short. Most of the action 65 65 happens elsewhere. 66 66 67 =item * A parser file67 =item * A parser file 68 68 69 69 The grammar for the high level language is specified using the Perl 6 70 70 grammar engine (PGE) and is stored in a C<.pg> file. This file should 71 71 subclass the C<PCT::Grammar> class and implement all the necessary 72 72 rules to successfully parse the language. 73 73 74 =item * An actions file74 =item * An actions file 75 75 76 76 Actions files are written in NQP. They take match objects generated by 77 77 the grammar file and convert them into an Abstract Syntax Tree (AST) … … 196 196 197 197 =over 4 198 198 199 =item * Rules199 =item * Rules 200 200 201 201 Rules are the most basic grammar element. Rules may call subrules and 202 202 may also contain arbitrary whitespace, which is ignored. 203 203 204 =item * Tokens204 =item * Tokens 205 205 206 206 Tokens represent basic regular expressions. They may not call subrules 207 207 and whitespace is treated literally. {{I don't think this is right, but 208 208 I'm adding it here anyway as a placeholder -- Whiteknight}} 209 209 210 =item * Protoregex210 =item * Protoregex 211 211 212 212 A protoregex is like a rule or a token, except it can be overloaded 213 213 dynamically. -
docs/book/ch04_pir_subroutines.pod
1 1 =pod 2 2 3 Z<CHP-4>4 5 3 =head1 Subroutines 6 4 7 5 Z<CHP-4> … … 454 452 455 453 =head2 Compilation Units Revisited 456 454 457 Z<CHP-4-SECT-1. 2>455 Z<CHP-4-SECT-1.1> 458 456 459 457 The term "compilation unit" is one that's been bandied about throughout the 460 458 chapter and it's worth some amount of explanation here. A compilation unit … … 499 497 500 498 =head3 PASM Subroutines 501 499 502 Z<CHP-4-SECT-1. 1>500 Z<CHP-4-SECT-1.2> 503 501 504 502 X<subroutines;PASM> 505 503 X<PASM (Parrot assembly language);subroutines> … … 537 535 538 536 =head3 Namespaces 539 537 540 Z<CHP-4-SECT-2 >538 Z<CHP-4-SECT-2.1> 541 539 542 540 X<Namespaces> 543 541 X<.namespace> … … 586 584 587 585 =head3 Calling Methods 588 586 589 Z<CHP-4-SECT-2 >587 Z<CHP-4-SECT-2.2> 590 588 591 589 Now that we've discussed namespaces, we can start to discuss all the 592 590 interesting things that namespaces enable, like object-oriented … … 793 791 794 792 =over 4 795 793 796 =item * Identifies coroutines794 =item * Identifies coroutines 797 795 798 796 When Parrot sees a yield, it knows to create a coroutine PMC object 799 797 instead of a Subroutine one. 800 798 801 =item * Creates a continuation799 =item * Creates a continuation 802 800 803 801 Continuations, as we have already seen, allow us to continue 804 802 execution at the point of the continuation later. It's like a snapshot of … … 806 804 the coroutine and stores the continuation object in the coroutine object 807 805 or later resuming from the point of the C<.yield>. 808 806 809 =item * Returns a value807 =item * Returns a value 810 808 811 809 C<.yield> can return a value N<or many values, or no values> to the caller. 812 810 It is basically the same as a C<.return> in this regard. -
docs/book/ch13_reference.pod
2 2 3 3 =head1 Parrot Reference 4 4 5 Z<CHP-1 0>5 Z<CHP-13> 6 6 7 7 This chapter contains a condensed list of PASM opcodes, PIR directives 8 8 and instructions, and Parrot command-line options, sorted alphabetically … … 13 13 14 14 =head2 PASM Opcodes 15 15 16 Z<CHP-1 0-SECT-1>16 Z<CHP-13-SECT-1> 17 17 18 18 X<PASM (Parrot assembly language);opcodes, quick reference> 19 19 For complete details on each opcode and the latest changes, read the … … 1245 1245 1246 1246 =begin table picture Interpinfo flags 1247 1247 1248 Z<CHP-1 0-TABLE-1>1248 Z<CHP-13-TABLE-1> 1249 1249 1250 1250 =headrow 1251 1251 … … 2415 2415 2416 2416 =begin table picture Stringinfo arguments 2417 2417 2418 Z<CHP-1 0-TABLE-2>2418 Z<CHP-13-TABLE-2> 2419 2419 2420 2420 =headrow 2421 2421 … … 2812 2812 2813 2813 =head2 PIR Directives 2814 2814 2815 Z<CHP-1 0-SECT-2>2815 Z<CHP-13-SECT-2> 2816 2816 2817 2817 X<PIR (Parrot intermediate representation);quick reference;directives> 2818 2818 This is a summary of PIR directives. Directives are preprocessed by the … … 3031 3031 3032 3032 =head2 PIR Instructions 3033 3033 3034 Z<CHP-1 0-SECT-3>3034 Z<CHP-13-SECT-3> 3035 3035 3036 3036 X<PIR (Parrot intermediate representation);quick reference;instructions> 3037 3037 This section is a quick reference to PIR instructions. For more details … … 3323 3323 3324 3324 =head2 Parrot Command-Line Options 3325 3325 3326 Z<CHP-1 0-SECT-4>3326 Z<CHP-13-SECT-4> 3327 3327 3328 3328 X<command-line options (Parrot)> 3329 3329 X<Parrot;command-line options> … … 3336 3336 3337 3337 =head3 General Usage 3338 3338 3339 Z<CHP-1 0-SECT-4.1>3339 Z<CHP-13-SECT-4.1> 3340 3340 3341 3341 parrot [options] file [arguments] 3342 3342 … … 3346 3346 3347 3347 =head3 Assembler Options 3348 3348 3349 Z<CHP-1 0-SECT-4.2>3349 Z<CHP-13-SECT-4.2> 3350 3350 3351 3351 =over 4 3352 3352 … … 3374 3374 3375 3375 =begin table picture Debug bits 3376 3376 3377 Z<CHP-1 0-TABLE-3>3377 Z<CHP-13-TABLE-3> 3378 3378 3379 3379 =headrow 3380 3380 … … 3513 3513 3514 3514 =begin table picture Optimizations 3515 3515 3516 Z<CHP-1 0-TABLE-4>3516 Z<CHP-13-TABLE-4> 3517 3517 3518 3518 =headrow 3519 3519 … … 3561 3561 3562 3562 =head3 Bytecode Interpreter Options 3563 3563 3564 Z<CHP-1 0-SECT-4.3>3564 Z<CHP-13-SECT-4.3> 3565 3565 3566 3566 X<Parrot;bytecode interpreter options> 3567 3567 X<bytecode interpreter options (Parrot)> -
docs/book/ch10_hlls.pod
165 165 166 166 =over 4 167 167 168 =item * VTable methods168 =item * VTable methods 169 169 170 170 VTable methods are the standard interface for PMC data types, and all PMCs 171 171 have them. If the PMCs were written properly to satisfy this interface 172 172 all the necessary information from those PMCs. Operate on the PMCs at the 173 173 VTable level, and we can safely ignore the implementation details of them. 174 174 175 =item * Class Methods175 =item * Class Methods 176 176 177 177 If a library returns data in a particular format, the library reuser should 178 178 know, understand, and make use of that format. Classes written in other -
docs/book/ch11_pmcs.pod
2 2 3 3 =head1 PMCs 4 4 5 Z<CHP-1 0>5 Z<CHP-11> 6 6 7 7 PMCs are one of the four fundamental data types in Parrot, and definitely one 8 8 of the most useful. A PMC can contain a single scalar value (integer, floating … … 229 229 =head3 Loading dynpmcs 230 230 231 231 232 =cut 232 233 233 234 234 ########################################################################## 235 235 # PSEUDOPOD LEGEND 236 236 # -
docs/book/ch07_testing_and_debugging.pod
2 2 3 3 =head0 Testing and Debugging 4 4 5 Z<CHP- 6>5 Z<CHP-7> 6 6 7 7 Programming languages and the virtual machines on which they run are just 8 8 one small part of the total programming ecosystem. Programmers require not … … 15 15 16 16 =head1 Writing Tests 17 17 18 Z<CHP- 6-SECT-1>18 Z<CHP-7-SECT-1> 19 19 20 20 X<testing Parrot> 21 21 Parrot is volunteer-driven, and contributions from new users are always … … 118 118 119 119 =head1 The Parrot Debugger 120 120 121 Z<CHP- 6-SECT-2>121 Z<CHP-7-SECT-2> 122 122 123 123 =cut 124 124