- Timestamp:
- Apr 15, 2019, 5:15:32 PM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 0efb269
- Parents:
- f29d603
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/user/user.tex
rf29d603 r4e84ef7 11 11 %% Created On : Wed Apr 6 14:53:29 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Tue Mar 26 22:10:49201914 %% Update Count : 34 1113 %% Last Modified On : Sun Apr 14 11:02:34 2019 14 %% Update Count : 3443 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 514 514 sout | 1 ®\® 0 | 1 ®\® 1 | 2 ®\® 8 | -4 ®\® 3 | 5 ®\® 3 | 5 ®\® 32 | 5L ®\® 32 | 5L ®\® 64 | -4 ®\® -3 | -4.0 ®\® -3 | 4.0 ®\® 2.1 515 515 | (1.0f+2.0fi) ®\® (3.0f+2.0fi); 516 1 1 256 -64 125 0 3273344365508751233 0 0 -0.015625 18.3791736799526 0.264715-1.1922i 517 \end{cfa} 516 1 1 256 -64 125 ®0® 3273344365508751233 ®0® ®0® -0.015625 18.3791736799526 0.264715-1.1922i 517 \end{cfa} 518 Note, ©5 ®\® 32© and ©5L ®\® 64© overflow, and ©-4 ®\® -3© is a fraction but stored in an integer so all three computations generate an integral zero. 518 519 Parenthesis are necessary for complex constants or the expression is parsed as ©1.0f+®(®2.0fi \ 3.0f®)®+2.0fi©. 519 520 The exponentiation operator is available for all the basic types, but for user-defined types, only the integral-computation version is available. … … 524 525 OT ?®\®?( OT ep, unsigned long int y ); 525 526 \end{cfa} 526 The user type ©T© must define multiplication one, ©1©, and, ©*©.527 The user type ©T© must define multiplication, one, ©1©, and, ©*©. 527 528 528 529 … … 554 555 \subsection{Loop Control} 555 556 556 The ©for©/©while©/©do-while© loop-control allows empty or simplified ranges. 557 The ©for©/©while©/©do-while© loop-control allows empty or simplified ranges (see Figure~\ref{f:LoopControlExamples}). 558 \begin{itemize} 559 \item 557 560 An empty conditional implies ©1©. 558 The up-to range ©~©\index{~@©~©} means exclusive range [M,N); 559 the up-to range ©~=©\index{~=@©~=©} means inclusive range [M,N]. 560 The down-to range ©-~©\index{-~@©-~©} means exclusive range [N,M); 561 the down-to range ©-~=©\index{-~=@©-~=©} means inclusive range [N,M]. 561 \item 562 The up-to range ©~©\index{~@©~©} means exclusive range [M,N). 563 \item 564 The up-to range ©~=©\index{~=@©~=©} means inclusive range [M,N]. 565 \item 566 The down-to range ©-~©\index{-~@©-~©} means exclusive range [N,M). 567 \item 568 The down-to range ©-~=©\index{-~=@©-~=©} means inclusive range [N,M]. 569 \item 570 ©@© means put nothing in this field. 571 \item 562 572 ©0© is the implicit start value; 573 \item 563 574 ©1© is the implicit increment value. 575 \item 564 576 The up-to range uses ©+=© for increment; 565 the down-to range uses ©-=© for decrement. 577 \item 578 The down-to range uses ©-=© for decrement. 579 \item 566 580 The loop index is polymorphic in the type of the start value or comparison value when start is implicitly ©0©. 581 \end{itemize} 582 583 \begin{figure} 567 584 \begin{cquote} 568 \begin{tabular}{@{}l l|l@{}}569 \multicolumn{ 2}{c|}{loop control} & \multicolumn{1}{c}{output} \\585 \begin{tabular}{@{}l|l@{}} 586 \multicolumn{1}{c|}{loop control} & \multicolumn{1}{c}{output} \\ 570 587 \hline 571 588 \begin{cfa} 572 while ®()® { sout | "empty"; break; } 573 do { sout | "empty"; break; } while ®()®; 574 for ®()® { sout | "empty"; break; } 575 for ( ®0® ) { sout | "A"; } 576 for ( ®1® ) { sout | "A"; } 577 for ( ®10® ) { sout | "A"; } 578 for ( ®1 ~= 10 ~ 2® ) { sout | "B"; } 579 for ( ®10 -~= 1 ~ 2® ) { sout | "C"; } 580 for ( ®0.5 ~ 5.5® ) { sout | "D"; } 581 for ( ®5.5 -~ 0.5® ) { sout | "E"; } 582 for ( ®i; 10® ) { sout | i; } 583 for ( ®i; 1 ~= 10 ~ 2® ) { sout | i; } 584 for ( ®i; 10 -~= 1 ~ 2® ) { sout | i; } 585 for ( ®i; 0.5 ~ 5.5® ) { sout | i; } 586 for ( ®i; 5.5 -~ 0.5® ) { sout | i; } 587 for ( ®ui; 2u ~= 10u ~ 2u® ) { sout | ui; } 588 for ( ®ui; 10u -~= 2u ~ 2u® ) { sout | ui; } 589 sout | nlOff; 590 while ®()® { sout | "empty"; break; } sout | nl; 591 do { sout | "empty"; break; } while ®()®; sout | nl; 592 for ®()® { sout | "empty"; break; } sout | nl; 593 for ( ®0® ) { sout | "A"; } sout | "zero" | nl; 594 for ( ®1® ) { sout | "A"; } sout | nl; 595 for ( ®10® ) { sout | "A"; } sout | nl; 596 for ( ®1 ~= 10 ~ 2® ) { sout | "B"; } sout | nl; 597 for ( ®10 -~= 1 ~ 2® ) { sout | "C"; } sout | nl; 598 for ( ®0.5 ~ 5.5® ) { sout | "D"; } sout | nl; 599 for ( ®5.5 -~ 0.5® ) { sout | "E"; } sout | nl; 600 for ( ®i; 10® ) { sout | i; } sout | nl; 601 for ( ®i; 1 ~= 10 ~ 2® ) { sout | i; } sout | nl; 602 for ( ®i; 10 -~= 1 ~ 2® ) { sout | i; } sout | nl; 603 for ( ®i; 0.5 ~ 5.5® ) { sout | i; } sout | nl; 604 for ( ®i; 5.5 -~ 0.5® ) { sout | i; } sout | nl; 605 for ( ®ui; 2u ~= 10u ~ 2u® ) { sout | ui; } sout | nl; 606 for ( ®ui; 10u -~= 2u ~ 2u® ) { sout | ui; } sout | nl; 589 607 enum { N = 10 }; 590 for ( ®N® ) { sout | "N"; } 591 for ( ®i; N® ) { sout | i; } 592 for ( ®i; N -~ 0® ) { sout | i; } 608 for ( ®N® ) { sout | "N"; } sout | nl; 609 for ( ®i; N® ) { sout | i; } sout | nl; 610 for ( ®i; N -~ 0® ) { sout | i; } sout | nl; 593 611 const int start = 3, comp = 10, inc = 2; 594 for ( ®i; start ~ comp ~ inc + 1® ) { sout | i; } 612 for ( ®i; start ~ comp ~ inc + 1® ) { sout | i; } sout | nl; 613 for ( ®i; 1 ~ @® ) { if ( i > 10 ) break; 614 sout | i; } sout | nl; 615 for ( ®i; 10 -~ @® ) { if ( i < 0 ) break; 616 sout | i; } sout | nl; 617 for ( ®i; 2 ~ @ ~ 2® ) { if ( i > 10 ) break; 618 sout | i; } sout | nl; 619 for ( ®i; 2.1 ~ @ ~ @® ) { if ( i > 10.5 ) break; 620 sout | i; i += 1.7; } sout | nl; 621 for ( ®i; 10 -~ @ ~ 2® ) { if ( i < 0 ) break; 622 sout | i; } sout | nl; 623 for ( ®i; 12.1 ~ @ ~ @® ) { if ( i < 2.5 ) break; 624 sout | i; i -= 1.7; } sout | nl; 625 for ( ®i; 5 : j; -5 ~ @® ) { sout | i | j; } sout | nl; 626 for ( ®i; 5 : j; -5 -~ @® ) { sout | i | j; } sout | nl; 627 for ( ®i; 5 : j; -5 ~ @ ~ 2® ) { sout | i | j; } sout | nl; 628 for ( ®i; 5 : j; -5 -~ @ ~ 2® ) { sout | i | j; } sout | nl; 629 for ( ®j; -5 ~ @ : i; 5® ) { sout | i | j; } sout | nl; 630 for ( ®j; -5 -~ @ : i; 5® ) { sout | i | j; } sout | nl; 631 for ( ®j; -5 ~ @ ~ 2 : i; 5® ) { sout | i | j; } sout | nl; 632 for ( ®j; -5 -~ @ ~ 2 : i; 5® ) { sout | i | j; } sout | nl; 633 for ( ®j; -5 -~ @ ~ 2 : i; 5 : k; 1.5 ~ @® ) { 634 sout | i | j | k; } sout | nl; 635 for ( ®j; -5 -~ @ ~ 2 : k; 1.5 ~ @ : i; 5® ) { 636 sout | i | j | k; } sout | nl; 637 for ( ®k; 1.5 ~ @ : j; -5 -~ @ ~ 2 : i; 5® ) { 638 sout | i | j | k; } sout | nl; 595 639 \end{cfa} 596 640 & 597 641 \begin{cfa} 598 sout | nl; 599 sout | nl; 600 sout | nl; 601 sout | "zero" | nl; 602 sout | nl; 603 sout | nl; 604 sout | nl; 605 sout | nl; 606 sout | nl; 607 sout | nl; 608 sout | nl; 609 sout | nl; 610 sout | nl; 611 sout | nl; 612 sout | nl; 613 sout | nl; 614 sout | nl | nl; 615 616 sout | nl; 617 sout | nl; 618 sout | nl | nl; 619 620 sout | nl; 621 \end{cfa} 622 & 623 \begin{cfa} 642 624 643 empty 625 644 empty … … 645 664 646 665 3 6 9 666 667 1 2 3 4 5 6 7 8 9 10 668 669 10 9 8 7 6 5 4 3 2 1 0 670 671 2 4 6 8 10 672 673 2.1 3.8 5.5 7.2 8.9 674 675 10 8 6 4 2 0 676 677 12.1 10.4 8.7 7 5.3 3.6 678 0 -5 1 -4 2 -3 3 -2 4 -1 679 0 -5 1 -6 2 -7 3 -8 4 -9 680 0 -5 1 -3 2 -1 3 1 4 3 681 0 -5 1 -7 2 -9 3 -11 4 -13 682 0 -5 1 -4 2 -3 3 -2 4 -1 683 0 -5 1 -6 2 -7 3 -8 4 -9 684 0 -5 1 -3 2 -1 3 1 4 3 685 0 -5 1 -7 2 -9 3 -11 4 -13 686 687 0 -5 1.5 1 -7 2.5 2 -9 3.5 3 -11 4.5 4 -13 5.5 688 689 0 -5 1.5 1 -7 2.5 2 -9 3.5 3 -11 4.5 4 -13 5.5 690 691 0 -5 1.5 1 -7 2.5 2 -9 3.5 3 -11 4.5 4 -13 5.5 647 692 \end{cfa} 648 693 \end{tabular} 649 694 \end{cquote} 695 \caption{Loop Control Examples} 696 \label{f:LoopControlExamples} 697 \end{figure} 650 698 651 699
Note: See TracChangeset
for help on using the changeset viewer.