OSDN Git Service

タグを打ち忘れていたついでに、html版ドキュメントを追加しました。
[ring-lang-081/ring.git] / docs / ja-jp / build / html / _sources / compiler.txt
1 .. index:: 
2         single: コマンドラインオプション; はじめに
3
4 ========================
5 コマンドラインオプション
6 ========================
7
8 Ring はソースコードファイル (\*.ring) または、オブジェクトファイル (\*.ringo) とオプションを指定するとプログラムを実行します。
9
10
11 書式:
12
13 .. code-block:: bash
14
15         ring <ファイル名.ring>|<ファイル名.ringo> [オプション]
16
17 オプション:
18
19 .. csv-table::
20         :header: "オプション", "説明"
21         :widths:       18,     82
22
23         "-tokens",              "ソースコードファイルのトークンリストを表示します。"
24         "-rules",               "トークンに適用された文法規則を表示します。"
25         "-ic",                  "中間バイトコードを表示します (実行前)。"
26         "-icfinal",     "最終バイトコードを表示します (実行後)。"
27         "-cgi",                 "エラーメッセージの前に http レスポンスヘッダを表示します。"
28         "-norun",               "コンパイル後にプログラムを実行しません。"
29         "-ins",                 "実行前に命令演算コードを表示します。"
30         "-performance", "プログラムの実行前後に処理時間測定結果を表示します。"
31         "-go",                  "オブジェクトファイルを生成します。"
32         "-geo",                 "組込型オブジェクトファイル (C ソースコード) を生成します。"
33         "-w",                   "警告を表示します。"
34
35 .. note:: オブジェクトファイル形式では、一部使用できないオプションがあります。
36
37
38 .. index:: 
39         pair: コマンドラインオプション; トークンの表示
40
41 トークンの表示
42 ==============
43
44 用例:
45
46 .. code-block:: ring
47
48         Func Main
49                 See "Hello World" + nl
50                 for x = 1 to 10
51                         see x + nl
52                 next
53                 test()
54
55         func test
56                 see "welcome" + nl
57                 o1 = new point { x=10 y=20 z=30 }
58                 see o1
59
60         class point x y z
61
62 コマンド:
63
64 .. code-block:: ring
65
66         ring test.ring -tokens -norun
67
68 実行結果:
69
70 .. code-block:: ring
71
72         ===================================================
73         Tokens - Generated by the Scanner
74         ===================================================
75
76            Keyword : FUNC
77         Identifier : main
78            EndLine
79            Keyword : SEE
80            Literal : Hello World
81           Operator : +
82         Identifier : nl
83            EndLine
84            Keyword : FOR
85         Identifier : x
86           Operator : =
87             Number : 1
88            Keyword : TO
89             Number : 10
90            EndLine
91            Keyword : SEE
92         Identifier : x
93           Operator : +
94         Identifier : nl
95            EndLine
96            Keyword : NEXT
97            EndLine
98         Identifier : test
99           Operator : (
100           Operator : )
101            EndLine
102            Keyword : FUNC
103         Identifier : test
104            EndLine
105            Keyword : SEE
106            Literal : welcome
107           Operator : +
108         Identifier : nl
109            EndLine
110         Identifier : o1
111           Operator : =
112            Keyword : NEW
113         Identifier : point
114           Operator : {
115         Identifier : x
116           Operator : =
117             Number : 10
118         Identifier : y
119           Operator : =
120             Number : 20
121         Identifier : z
122           Operator : =
123             Number : 30
124           Operator : }
125            EndLine
126            Keyword : SEE
127         Identifier : o1
128            EndLine
129            Keyword : CLASS
130         Identifier : point
131         Identifier : x
132         Identifier : y
133         Identifier : z
134            EndLine
135
136         ===================================================
137
138 .. index:: 
139         pair: コマンドラインオプション; 文法規則の表示
140
141 文法規則の表示
142 ==============
143
144 コマンド:
145
146 .. code-block:: ring
147
148         ring test.ring -rules -norun
149
150 実行結果:
151
152 .. code-block:: ring
153
154         ===================================================
155         Grammar Rules Used by The Parser
156         ===================================================
157
158         Rule : Program --> {Statement}
159
160         Line 1
161         Rule : Statement  --> 'Func' Identifier [ParaList]
162
163         Line 2
164         Rule : Factor --> Literal
165         Rule : Range --> Factor
166         Rule : Term --> Range
167         Rule : Arithmetic --> Term
168         Rule : Factor --> Identifier [ {Mixer} | Assignment | PlusPlus | MinusMinus]
169         Rule : Range --> Factor
170         Rule : Term --> Range
171         Rule : Arithmetic --> Term
172         Rule : Arithmetic --> Arithmetic + Arithmetic
173         Rule : BitShift --> Arithmetic
174         Rule : BitAnd --> BitShift
175         Rule : BitOrXOR -->  BitAnd
176         Rule : Compare --> BitOrXOR
177         Rule : EqualOrNot --> Compare
178         Rule : LogicNot -> EqualOrNot
179         Rule : Expr --> LogicNot
180         Rule : Statement  --> 'See' Expr
181
182         Line 3
183         Rule : Factor --> Number
184         Rule : Range --> Factor
185         Rule : Term --> Range
186         Rule : Arithmetic --> Term
187         Rule : BitShift --> Arithmetic
188         Rule : BitAnd --> BitShift
189         Rule : BitOrXOR -->  BitAnd
190         Rule : Compare --> BitOrXOR
191         Rule : EqualOrNot --> Compare
192         Rule : LogicNot -> EqualOrNot
193         Rule : Expr --> LogicNot
194         Rule : Factor --> Number
195         Rule : Range --> Factor
196         Rule : Term --> Range
197         Rule : Arithmetic --> Term
198         Rule : BitShift --> Arithmetic
199         Rule : BitAnd --> BitShift
200         Rule : BitOrXOR -->  BitAnd
201         Rule : Compare --> BitOrXOR
202         Rule : EqualOrNot --> Compare
203         Rule : LogicNot -> EqualOrNot
204         Rule : Expr --> LogicNot
205         Rule : Statement  --> 'For' Identifier '=' Expr to Expr ['step' Expr]
206
207         Line 4
208         Rule : Factor --> Identifier [ {Mixer} | Assignment | PlusPlus | MinusMinus]
209         Rule : Range --> Factor
210         Rule : Term --> Range
211         Rule : Arithmetic --> Term
212         Rule : Factor --> Identifier [ {Mixer} | Assignment | PlusPlus | MinusMinus]
213         Rule : Range --> Factor
214         Rule : Term --> Range
215         Rule : Arithmetic --> Term
216         Rule : Arithmetic --> Arithmetic + Arithmetic
217         Rule : BitShift --> Arithmetic
218         Rule : BitAnd --> BitShift
219         Rule : BitOrXOR -->  BitAnd
220         Rule : Compare --> BitOrXOR
221         Rule : EqualOrNot --> Compare
222         Rule : LogicNot -> EqualOrNot
223         Rule : Expr --> LogicNot
224         Rule : Statement  --> 'See' Expr
225
226         Line 5
227         Rule : Next --> 'Next'
228
229         Line 6
230         Rule : Mixer -> '(' [Expr { ',' Expr} ] ')'
231
232         Line 8
233         Rule : Factor --> Identifier [ {Mixer} | Assignment | PlusPlus | MinusMinus]
234         Rule : Range --> Factor
235         Rule : Term --> Range
236         Rule : Arithmetic --> Term
237         Rule : BitShift --> Arithmetic
238         Rule : BitAnd --> BitShift
239         Rule : BitOrXOR -->  BitAnd
240         Rule : Compare --> BitOrXOR
241         Rule : EqualOrNot --> Compare
242         Rule : LogicNot -> EqualOrNot
243         Rule : Expr --> LogicNot
244         Rule : Statement  --> Expr
245         Rule : Statement  --> 'Func' Identifier [ParaList]
246
247         Line 9
248         Rule : Factor --> Literal
249         Rule : Range --> Factor
250         Rule : Term --> Range
251         Rule : Arithmetic --> Term
252         Rule : Factor --> Identifier [ {Mixer} | Assignment | PlusPlus | MinusMinus]
253         Rule : Range --> Factor
254         Rule : Term --> Range
255         Rule : Arithmetic --> Term
256         Rule : Arithmetic --> Arithmetic + Arithmetic
257         Rule : BitShift --> Arithmetic
258         Rule : BitAnd --> BitShift
259         Rule : BitOrXOR -->  BitAnd
260         Rule : Compare --> BitOrXOR
261         Rule : EqualOrNot --> Compare
262         Rule : LogicNot -> EqualOrNot
263         Rule : Expr --> LogicNot
264         Rule : Statement  --> 'See' Expr
265
266         Line 10
267         Rule : Factor --> New Identifier {'.' Identifier }
268         Rule : Mixer --> '{' {Statement} BraceEnd
269         Rule : Factor --> Number
270         Rule : Range --> Factor
271         Rule : Term --> Range
272         Rule : Arithmetic --> Term
273         Rule : BitShift --> Arithmetic
274         Rule : BitAnd --> BitShift
275         Rule : BitOrXOR -->  BitAnd
276         Rule : Compare --> BitOrXOR
277         Rule : EqualOrNot --> Compare
278         Rule : LogicNot -> EqualOrNot
279         Rule : Expr --> LogicNot
280         Rule : Assignment -> '=' Expr
281         Rule : Factor --> Identifier [ {Mixer} | Assignment | PlusPlus | MinusMinus]
282         Rule : Range --> Factor
283         Rule : Term --> Range
284         Rule : Arithmetic --> Term
285         Rule : BitShift --> Arithmetic
286         Rule : BitAnd --> BitShift
287         Rule : BitOrXOR -->  BitAnd
288         Rule : Compare --> BitOrXOR
289         Rule : EqualOrNot --> Compare
290         Rule : LogicNot -> EqualOrNot
291         Rule : Expr --> LogicNot
292         Rule : Statement  --> Expr
293         Rule : Factor --> Number
294         Rule : Range --> Factor
295         Rule : Term --> Range
296         Rule : Arithmetic --> Term
297         Rule : BitShift --> Arithmetic
298         Rule : BitAnd --> BitShift
299         Rule : BitOrXOR -->  BitAnd
300         Rule : Compare --> BitOrXOR
301         Rule : EqualOrNot --> Compare
302         Rule : LogicNot -> EqualOrNot
303         Rule : Expr --> LogicNot
304         Rule : Assignment -> '=' Expr
305         Rule : Factor --> Identifier [ {Mixer} | Assignment | PlusPlus | MinusMinus]
306         Rule : Range --> Factor
307         Rule : Term --> Range
308         Rule : Arithmetic --> Term
309         Rule : BitShift --> Arithmetic
310         Rule : BitAnd --> BitShift
311         Rule : BitOrXOR -->  BitAnd
312         Rule : Compare --> BitOrXOR
313         Rule : EqualOrNot --> Compare
314         Rule : LogicNot -> EqualOrNot
315         Rule : Expr --> LogicNot
316         Rule : Statement  --> Expr
317         Rule : Factor --> Number
318         Rule : Range --> Factor
319         Rule : Term --> Range
320         Rule : Arithmetic --> Term
321         Rule : BitShift --> Arithmetic
322         Rule : BitAnd --> BitShift
323         Rule : BitOrXOR -->  BitAnd
324         Rule : Compare --> BitOrXOR
325         Rule : EqualOrNot --> Compare
326         Rule : LogicNot -> EqualOrNot
327         Rule : Expr --> LogicNot
328         Rule : Assignment -> '=' Expr
329         Rule : Factor --> Identifier [ {Mixer} | Assignment | PlusPlus | MinusMinus]
330         Rule : Range --> Factor
331         Rule : Term --> Range
332         Rule : Arithmetic --> Term
333         Rule : BitShift --> Arithmetic
334         Rule : BitAnd --> BitShift
335         Rule : BitOrXOR -->  BitAnd
336         Rule : Compare --> BitOrXOR
337         Rule : EqualOrNot --> Compare
338         Rule : LogicNot -> EqualOrNot
339         Rule : Expr --> LogicNot
340         Rule : Statement  --> Expr
341         Rule : BraceEnd --> '}'
342         Rule : Range --> Factor
343         Rule : Term --> Range
344         Rule : Arithmetic --> Term
345         Rule : BitShift --> Arithmetic
346         Rule : BitAnd --> BitShift
347         Rule : BitOrXOR -->  BitAnd
348         Rule : Compare --> BitOrXOR
349         Rule : EqualOrNot --> Compare
350         Rule : LogicNot -> EqualOrNot
351         Rule : Expr --> LogicNot
352         Rule : Assignment -> '=' Expr
353         Rule : Factor --> Identifier [ {Mixer} | Assignment | PlusPlus | MinusMinus]
354         Rule : Range --> Factor
355         Rule : Term --> Range
356         Rule : Arithmetic --> Term
357         Rule : BitShift --> Arithmetic
358         Rule : BitAnd --> BitShift
359         Rule : BitOrXOR -->  BitAnd
360         Rule : Compare --> BitOrXOR
361         Rule : EqualOrNot --> Compare
362         Rule : LogicNot -> EqualOrNot
363         Rule : Expr --> LogicNot
364         Rule : Statement  --> Expr
365
366         Line 11
367         Rule : Factor --> Identifier [ {Mixer} | Assignment | PlusPlus | MinusMinus]
368         Rule : Range --> Factor
369         Rule : Term --> Range
370         Rule : Arithmetic --> Term
371         Rule : BitShift --> Arithmetic
372         Rule : BitAnd --> BitShift
373         Rule : BitOrXOR -->  BitAnd
374         Rule : Compare --> BitOrXOR
375         Rule : EqualOrNot --> Compare
376         Rule : LogicNot -> EqualOrNot
377         Rule : Expr --> LogicNot
378         Rule : Statement  --> 'See' Expr
379
380         Line 13
381         Rule : Statement  --> 'Class' Identifier
382         Rule : Factor --> Identifier [ {Mixer} | Assignment | PlusPlus | MinusMinus]
383         Rule : Range --> Factor
384         Rule : Term --> Range
385         Rule : Arithmetic --> Term
386         Rule : BitShift --> Arithmetic
387         Rule : BitAnd --> BitShift
388         Rule : BitOrXOR -->  BitAnd
389         Rule : Compare --> BitOrXOR
390         Rule : EqualOrNot --> Compare
391         Rule : LogicNot -> EqualOrNot
392         Rule : Expr --> LogicNot
393         Rule : Statement  --> Expr
394         Rule : Factor --> Identifier [ {Mixer} | Assignment | PlusPlus | MinusMinus]
395         Rule : Range --> Factor
396         Rule : Term --> Range
397         Rule : Arithmetic --> Term
398         Rule : BitShift --> Arithmetic
399         Rule : BitAnd --> BitShift
400         Rule : BitOrXOR -->  BitAnd
401         Rule : Compare --> BitOrXOR
402         Rule : EqualOrNot --> Compare
403         Rule : LogicNot -> EqualOrNot
404         Rule : Expr --> LogicNot
405         Rule : Statement  --> Expr
406         Rule : Factor --> Identifier [ {Mixer} | Assignment | PlusPlus | MinusMinus]
407         Rule : Range --> Factor
408         Rule : Term --> Range
409         Rule : Arithmetic --> Term
410         Rule : BitShift --> Arithmetic
411         Rule : BitAnd --> BitShift
412         Rule : BitOrXOR -->  BitAnd
413         Rule : Compare --> BitOrXOR
414         Rule : EqualOrNot --> Compare
415         Rule : LogicNot -> EqualOrNot
416         Rule : Expr --> LogicNot
417         Rule : Statement  --> Expr
418
419         ===================================================
420
421 .. index:: 
422         pair: コマンドラインオプション; 中間コードの表示
423
424 中間コードの表示
425 ================
426
427 コマンド:
428
429 .. code-block:: ring
430
431         ring test.ring -ic -norun
432
433 実行結果:
434
435 .. code-block:: ring
436
437         ===================================================
438         Byte Code - Before Execution by the VM
439         ===================================================
440
441                  PC      OPCode        Data
442
443                   1  ReturnNull
444                   2        Func    main
445                   3     NewLine       2
446                   4     FuncExE
447                   5       PushC   Hello World
448                   6       LoadA      nl      0
449                   7       PushV
450                   8         SUM       0
451                   9       Print
452                  10     NewLine       3
453                  11    ExitMark      29     28
454                  12  LoadAFirst       x
455                  13       PushN   1.000000
456                  14  BeforeEqual       0
457                  15  Assignment
458                  16       PushN   1.000000
459                  17  StepNumber
460                  18  JumpVarLENum       x  10.000000    29
461                  19     NewLine       4
462                  20     FuncExE
463                  21       LoadA       x      0
464                  22       PushV
465                  23       LoadA      nl      0
466                  24       PushV
467                  25         SUM       0
468                  26       Print
469                  27     NewLine       5
470                  28     IncJump       x     18
471                  29  POPExitMark
472                  30     POPStep
473                  31     NewLine       6
474                  32    LoadFunc    test
475                  33        Call       0
476                  34  NoOperation
477                  35     NewLine       8
478                  36       PushV
479                  37   FreeStack
480                  38  ReturnNull
481                  39        Func    test
482                  40     NewLine       9
483                  41     FuncExE
484                  42       PushC   welcome
485                  43       LoadA      nl      0
486                  44       PushV
487                  45         SUM       0
488                  46       Print
489                  47     NewLine      10
490                  48       LoadA      o1      0
491                  49  AssignmentPointer
492                  50         New   point
493                  51    SetScope
494                  52       PushV
495                  53  BraceStart
496                  54       LoadA       x      0     58
497                  55  AssignmentPointer
498                  56       PushN   10.000000
499                  57  BeforeEqual       0
500                  58  Assignment       0      0
501                  59   FreeStack
502                  60       LoadA       y      0     64
503                  61  AssignmentPointer
504                  62       PushN   20.000000
505                  63  BeforeEqual       0
506                  64  Assignment       0      0
507                  65   FreeStack
508                  66       LoadA       z      0     70
509                  67  AssignmentPointer
510                  68       PushN   30.000000
511                  69  BeforeEqual       0
512                  70  Assignment       0      0
513                  71   FreeStack
514                  72    LoadFunc   ismethod
515                  73       LoadA    self      0
516                  74       PushV
517                  75       PushC   braceend
518                  76        Call
519                  77  NoOperation
520                  78       PushV
521                  79       JumpZ      85
522                  80    LoadFunc   braceend
523                  81        Call
524                  82  NoOperation
525                  83       PushV
526                  84   FreeStack
527                  85    BraceEnd
528                  86   FreeStack
529                  87     NewLine      11
530                  88     FuncExE
531                  89       LoadA      o1      0
532                  90       PushV
533                  91       Print
534                  92     NewLine      13
535                  93  ReturnNull
536                  94       Class   point  006E8BC0
537                  95    NewLabel
538                  96       LoadA       x      0
539                  97       PushV
540                  98   FreeStack
541                  99       LoadA       y      0
542                 100       PushV
543                 101   FreeStack
544                 102       LoadA       z      0
545                 103       PushV
546                 104   FreeStack
547                 105  ReturnNull
548
549         ===================================================
550
551 .. index:: 
552         pair: コマンドラインオプション; 最終中間コードの表示
553
554 最終中間コードの表示
555 ====================
556
557 コマンド:
558
559 .. code-block:: ring
560
561         ring test.ring -icfinal
562
563 実行結果:
564
565 .. code-block:: ring
566
567         Hello World
568         1
569         2
570         3
571         4
572         5
573         6
574         7
575         8
576         9
577         10
578         welcome
579         x: 10.000000
580         y: 20.000000
581         z: 30.000000
582
583
584         ===================================================
585         Byte Code - After Execution by the VM
586         ===================================================
587
588                  PC      OPCode        Data
589
590                   1  ReturnNull
591                   2        Func    main
592                   3     NewLine       2
593                   4     FuncExE
594                   5       PushC   Hello World
595                   6       PushP   007D3670      0
596                   7       PushV
597                   8         SUM       0
598                   9       Print
599                  10     NewLine       3
600                  11    ExitMark      29     28
601                  12  LoadAFirst       x
602                  13       PushN   1.000000
603                  14  BeforeEqual       0
604                  15  Assignment
605                  16       PushN   1.000000
606                  17  StepNumber
607                  18  JumpVarLPLENum       x  10.000000    29
608                  19     NewLine       4
609                  20     FuncExE
610                  21  PushPLocal       x      0
611                  22       PushV
612                  23       PushP   007D3670      0
613                  24       PushV
614                  25         SUM       0
615                  26       Print
616                  27     NewLine       5
617                  28   IncLPJump       x     18
618                  29  POPExitMark
619                  30     POPStep
620                  31     NewLine       6
621                  32   LoadFuncP    test
622                  33        Call       0
623                  34  NoOperation
624                  35     NewLine       8
625                  36       PushV
626                  37   FreeStack
627                  38  ReturnNull
628                  39        Func    test
629                  40     NewLine       9
630                  41     FuncExE
631                  42       PushC   welcome
632                  43       PushP   007D3670      0
633                  44       PushV
634                  45         SUM       0
635                  46       Print
636                  47     NewLine      10
637                  48  PushPLocal      o1      0
638                  49  AssignmentPointer
639                  50         New   point
640                  51    SetScope
641                  52       PushV
642                  53  BraceStart
643                  54       LoadA       x      0     58
644                  55  AssignmentPointer
645                  56       PushN   10.000000
646                  57  BeforeEqual       0
647                  58  SetProperty       0    106
648                  59   FreeStack
649                  60       LoadA       y      0     64
650                  61  AssignmentPointer
651                  62       PushN   20.000000
652                  63  BeforeEqual       0
653                  64  SetProperty       0    141
654                  65   FreeStack
655                  66       LoadA       z      0     70
656                  67  AssignmentPointer
657                  68       PushN   30.000000
658                  69  BeforeEqual       0
659                  70  SetProperty       0    176
660                  71   FreeStack
661                  72    LoadFunc   ismethod
662                  73       LoadA    self      0
663                  74       PushV
664                  75       PushC   braceend
665                  76        Call
666                  77  NoOperation
667                  78       PushV
668                  79       JumpZ      85
669                  80    LoadFunc   braceend
670                  81        Call
671                  82  NoOperation
672                  83       PushV
673                  84   FreeStack
674                  85    BraceEnd
675                  86   FreeStack
676                  87     NewLine      11
677                  88     FuncExE
678                  89  PushPLocal      o1      0
679                  90       PushV
680                  91       Print
681                  92     NewLine      13
682                  93  ReturnNull
683                  94       Class   point  007D8470
684                  95    NewLabel
685                  96       LoadA       x      0
686                  97       PushV
687                  98   FreeStack
688                  99       LoadA       y      0
689                 100       PushV
690                 101   FreeStack
691                 102       LoadA       z      0
692                 103       PushV
693                 104   FreeStack
694                 105  ReturnNull
695                 106    LoadFunc   ismethod
696                 107       LoadA   ring_gettemp_var      0
697                 108       PushV
698                 109       PushC    setx
699                 110        Call       0
700                 111  NoOperation
701                 112       PushV
702                 113       JumpZ     132
703                 114     NewLine       2
704                 115       LoadA   ring_gettemp_var      0
705                 116  LoadMethod    setx
706                 117       LoadA   ring_settemp_var      0
707                 118       PushV
708                 119        Call       0      1
709                 120  AfterCallMethod
710                 121       PushV
711                 122   FreeStack
712                 123     NewLine       3
713                 124       LoadA   ring_tempflag_var      0    128
714                 125  AssignmentPointer
715                 126       PushN   0.000000
716                 127  BeforeEqual       0
717                 128  Assignment       0      0
718                 129   FreeStack
719                 130     NewLine       4
720                 131        Jump     140
721                 132     NewLine       5
722                 133       PushP   007D37D8      0    137
723                 134  AssignmentPointer
724                 135       PushN   1.000000
725                 136  BeforeEqual       0
726                 137  Assignment       0      0
727                 138   FreeStack
728                 139     NewLine       6
729                 140      Return
730                 141    LoadFunc   ismethod
731                 142       LoadA   ring_gettemp_var      0
732                 143       PushV
733                 144       PushC    sety
734                 145        Call       0
735                 146  NoOperation
736                 147       PushV
737                 148       JumpZ     167
738                 149     NewLine       2
739                 150       LoadA   ring_gettemp_var      0
740                 151  LoadMethod    sety
741                 152       LoadA   ring_settemp_var      0
742                 153       PushV
743                 154        Call       0      1
744                 155  AfterCallMethod
745                 156       PushV
746                 157   FreeStack
747                 158     NewLine       3
748                 159       LoadA   ring_tempflag_var      0    163
749                 160  AssignmentPointer
750                 161       PushN   0.000000
751                 162  BeforeEqual       0
752                 163  Assignment       0      0
753                 164   FreeStack
754                 165     NewLine       4
755                 166        Jump     175
756                 167     NewLine       5
757                 168       PushP   007D37D8      0    172
758                 169  AssignmentPointer
759                 170       PushN   1.000000
760                 171  BeforeEqual       0
761                 172  Assignment       0      0
762                 173   FreeStack
763                 174     NewLine       6
764                 175      Return
765                 176    LoadFunc   ismethod
766                 177       LoadA   ring_gettemp_var      0
767                 178       PushV
768                 179       PushC    setz
769                 180        Call       0
770                 181  NoOperation
771                 182       PushV
772                 183       JumpZ     202
773                 184     NewLine       2
774                 185       LoadA   ring_gettemp_var      0
775                 186  LoadMethod    setz
776                 187       LoadA   ring_settemp_var      0
777                 188       PushV
778                 189        Call       0      1
779                 190  AfterCallMethod
780                 191       PushV
781                 192   FreeStack
782                 193     NewLine       3
783                 194       LoadA   ring_tempflag_var      0    198
784                 195  AssignmentPointer
785                 196       PushN   0.000000
786                 197  BeforeEqual       0
787                 198  Assignment       0      0
788                 199   FreeStack
789                 200     NewLine       4
790                 201        Jump     210
791                 202     NewLine       5
792                 203       PushP   007D37D8      0    207
793                 204  AssignmentPointer
794                 205       PushN   1.000000
795                 206  BeforeEqual       0
796                 207  Assignment       0      0
797                 208   FreeStack
798                 209     NewLine       6
799                 210      Return
800
801         ===================================================
802
803 .. index:: 
804         pair: コマンドラインオプション; CGI への対応
805
806
807 CGI への対応
808 ============
809
810 コマンド:
811
812 .. code-block:: ring
813
814         ring test.ring -cgi
815
816 .. index:: 
817         pair: コマンドラインオプション; コンパイルの実行
818
819 コンパイルの実行
820 ================
821
822 コマンド:
823
824 .. code-block:: ring
825
826         ring test.ring -norun
827
828 .. index:: 
829         pair: コマンドラインオプション; 命令演算コードの表示
830
831 命令演算コードの表示
832 ====================
833
834 コマンド:
835
836 .. code-block:: ring
837
838         ring test.ring -ins
839
840
841 実行結果:
842
843 .. code-block:: ring
844
845         ===================================================
846
847         Operation  : ReturnNull  
848         PC         : 1  
849         Line Number    : 1  , File test.ring 
850          
851         SP (After) : 0  - FuncSP : 0 
852          LineNumber 1 
853         ===================================================
854         .....
855         .....
856         .....
857         
858 .. tip:: 前述の用例は非常に大きいので実行結果を省略してあります!
859
860 .. index:: 
861         pair: コマンドラインオプション; 実行性能の計測
862
863 実行性能の計測
864 ==============
865
866 コマンド:
867
868 .. code-block:: ring
869
870         ring test.ring -performance
871
872 実行結果:
873
874 .. code-block:: ring
875
876         ===================================================
877         Date  : 2015/09/15 Time : 15:56:17
878         Clock : 0 
879         ===================================================
880         Hello World
881         1
882         2
883         3
884         4
885         5
886         6
887         7
888         8
889         9
890         10
891         welcome
892         x: 10.000000
893         y: 20.000000
894         z: 30.000000
895         
896         ===================================================
897         Date  : 2015/09/15 Time : 15:56:17
898         Clock : 0 
899         ===================================================
900
901 .. index:: 
902         pair: コマンドラインオプション; オブジェクトファイルの生成
903
904 オブジェクトファイルの生成
905 ==========================
906
907 -go オプションは、ソースコードファイル (\*.ring) からオブジェクトファイル (\*.ringo) を生成します。
908
909 .. tip:: アプリケーション (商用またはオープンソース) の Ring ソースファイル一式を非公開 (保管) または配布できます。
910         また、アプリケーションの配布または実行用のオブジェクトファイルも生成できます。
911
912 コマンド:
913
914 .. code-block:: ring
915
916         ring test.ring -go
917
918 コンパイル済みのオブジェクトファイルを実行するには、
919
920 .. code-block:: ring
921
922         ring test.ringo
923
924
925 .. index:: 
926         pair: コマンドラインオプション; 組込型オブジェクトファイルの生成
927
928 組込型オブジェクトファイルの生成
929 ================================
930
931 -geo オプションはソースコードファイル (\*.ring) から組込型オブジェクトファイル (C ソースコード) を生成します。
932
933 コマンド:
934
935 .. code-block:: ring
936
937         ring test.ring -geo
938
939 このコマンドは最低でも 3 ファイルを生成します。
940
941 .. code-block:: ring
942
943         test.c
944         ringappcode.c
945         ringappcode.h
946
947 プロジェクトの規模により、それ以上のファイルを生成します。
948
949 生成後のファイルは Ring VM のバイトコードとして実行されます。