2 single: コマンドラインオプション; はじめに
4 ========================
6 ========================
8 Ring はソースコードファイル (\*.ring) または、オブジェクトファイル (\*.ringo) とオプションを指定するとプログラムを実行します。
15 ring <ファイル名.ring>|<ファイル名.ringo> [オプション]
20 :header: "オプション", "説明"
23 "-tokens", "ソースコードファイルのトークンリストを表示します。"
24 "-rules", "トークンに適用された文法規則を表示します。"
25 "-ic", "中間バイトコードを表示します (実行前)。"
26 "-icfinal", "最終バイトコードを表示します (実行後)。"
27 "-cgi", "エラーメッセージの前に http レスポンスヘッダを表示します。"
28 "-norun", "コンパイル後にプログラムを実行しません。"
29 "-ins", "実行前に命令演算コードを表示します。"
30 "-performance", "プログラムの実行前後に処理時間測定結果を表示します。"
31 "-go", "オブジェクトファイルを生成します。"
32 "-geo", "組込型オブジェクトファイル (C ソースコード) を生成します。"
35 .. note:: オブジェクトファイル形式では、一部使用できないオプションがあります。
39 pair: コマンドラインオプション; トークンの表示
49 See "Hello World" + nl
57 o1 = new point { x=10 y=20 z=30 }
66 ring test.ring -tokens -norun
72 ===================================================
73 Tokens - Generated by the Scanner
74 ===================================================
136 ===================================================
139 pair: コマンドラインオプション; 文法規則の表示
148 ring test.ring -rules -norun
154 ===================================================
155 Grammar Rules Used by The Parser
156 ===================================================
158 Rule : Program --> {Statement}
161 Rule : Statement --> 'Func' Identifier [ParaList]
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
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]
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
227 Rule : Next --> 'Next'
230 Rule : Mixer -> '(' [Expr { ',' Expr} ] ')'
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]
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
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
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
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
419 ===================================================
422 pair: コマンドラインオプション; 中間コードの表示
431 ring test.ring -ic -norun
437 ===================================================
438 Byte Code - Before Execution by the VM
439 ===================================================
460 18 JumpVarLENum x 10.000000 29
536 94 Class point 006E8BC0
549 ===================================================
552 pair: コマンドラインオプション; 最終中間コードの表示
561 ring test.ring -icfinal
584 ===================================================
585 Byte Code - After Execution by the VM
586 ===================================================
607 18 JumpVarLPLENum x 10.000000 29
683 94 Class point 007D8470
695 106 LoadFunc ismethod
696 107 LoadA ring_gettemp_var 0
704 115 LoadA ring_gettemp_var 0
706 117 LoadA ring_settemp_var 0
713 124 LoadA ring_tempflag_var 0 128
714 125 AssignmentPointer
722 133 PushP 007D37D8 0 137
723 134 AssignmentPointer
730 141 LoadFunc ismethod
731 142 LoadA ring_gettemp_var 0
739 150 LoadA ring_gettemp_var 0
741 152 LoadA ring_settemp_var 0
748 159 LoadA ring_tempflag_var 0 163
749 160 AssignmentPointer
757 168 PushP 007D37D8 0 172
758 169 AssignmentPointer
765 176 LoadFunc ismethod
766 177 LoadA ring_gettemp_var 0
774 185 LoadA ring_gettemp_var 0
776 187 LoadA ring_settemp_var 0
783 194 LoadA ring_tempflag_var 0 198
784 195 AssignmentPointer
792 203 PushP 007D37D8 0 207
793 204 AssignmentPointer
801 ===================================================
804 pair: コマンドラインオプション; CGI への対応
817 pair: コマンドラインオプション; コンパイルの実行
826 ring test.ring -norun
829 pair: コマンドラインオプション; 命令演算コードの表示
845 ===================================================
847 Operation : ReturnNull
849 Line Number : 1 , File test.ring
851 SP (After) : 0 - FuncSP : 0
853 ===================================================
858 .. tip:: 前述の用例は非常に大きいので実行結果を省略してあります!
861 pair: コマンドラインオプション; 実行性能の計測
870 ring test.ring -performance
876 ===================================================
877 Date : 2015/09/15 Time : 15:56:17
879 ===================================================
896 ===================================================
897 Date : 2015/09/15 Time : 15:56:17
899 ===================================================
902 pair: コマンドラインオプション; オブジェクトファイルの生成
905 ==========================
907 -go オプションは、ソースコードファイル (\*.ring) からオブジェクトファイル (\*.ringo) を生成します。
909 .. tip:: アプリケーション (商用またはオープンソース) の Ring ソースファイル一式を非公開 (保管) または配布できます。
910 また、アプリケーションの配布または実行用のオブジェクトファイルも生成できます。
918 コンパイル済みのオブジェクトファイルを実行するには、
926 pair: コマンドラインオプション; 組込型オブジェクトファイルの生成
929 ================================
931 -geo オプションはソースコードファイル (\*.ring) から組込型オブジェクトファイル (C ソースコード) を生成します。
939 このコマンドは最低でも 3 ファイルを生成します。
947 プロジェクトの規模により、それ以上のファイルを生成します。
949 生成後のファイルは Ring VM のバイトコードとして実行されます。