• R/O
  • SSH

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修訂ef1c39bd73ea4dba0bcfcf0a7e0bf65b53ff975c (tree)
時間2022-05-14 07:51:11
作者Albert Mietus < albert AT mietus DOT nl >
CommiterAlbert Mietus < albert AT mietus DOT nl >

Log Message

Small text-refactoring

Change Summary

差異

diff -r bc28f6918f5c -r ef1c39bd73ea CCastle/Usage/CompilerCompiler.rst
--- a/CCastle/Usage/CompilerCompiler.rst Sat May 14 00:50:32 2022 +0200
+++ b/CCastle/Usage/CompilerCompiler.rst Sat May 14 00:51:11 2022 +0200
@@ -4,9 +4,9 @@
44 Compiler Compiler
55 =================
66
7-.. post:: 2022/05/20
8- :category: Castle
9- :tags: Castle
7+.. post:: 2022/05/7
8+ :category: Castle, Usage
9+ :tags: Castle, grammar
1010
1111 In Castle you can define a *grammar* directly in your code. The compiler will *translate* them into functions, using
1212 the build-in (PEG) **compiler-compiler** -- at least that was it called back in the days of *YACC*.
@@ -21,11 +21,11 @@
2121
2222 .. code-block:: PEG
2323
24- castle_file <- ( import_line | interface | implementation )* ;
25- import_line <- IMPORT_stmt ( STRING_literal | qualID ) ';' ;
26- qualID <- '.'? nameID ('.' nameID )* ;
27- IMPORT_stmt = "import" ;
28- ...
24+ castle_file <- ( import_line | interface | implementation )* ;
25+ import_line <- IMPORT_stmt ( STRING_literal | qualID ) ';' ;
26+ qualID <- '.'? nameID ('.' nameID )* ;
27+ IMPORT_stmt = "import" ;
28+ ...
2929
3030
3131 This basically defines that a ``castle_file`` is either an ``import_line``, an ``interface``, an ``implementation``, or
@@ -62,16 +62,20 @@
6262
6363 There a many ways to *parse*. You do not need a full-fledged grammer to translate “42” into :math:`42` or
6464 :math:`42.0` --a stdlib functions as ``atoi()`` or ``atof()`` will do. But how about handling complex numbers
65-(:math:`4+j2`), fractions (:math:`\frac{17}{42}`)?
65+(:math:`4+j2`) or fractions (:math:`\frac{17}{42}`)?
6666
6767 Non-parsing
6868 -----------
6969
7070 As proper passing used to hard, other similar (but simpler) techniques do exist, like `globing
71-<https://en.wikipedia.org/wiki/Glob_(programming)>`__ (\*.Castle on the bash-prompt will result in all
71+<https://en.wikipedia.org/wiki/Glob_(programming)>`__ (``\*.Castle`` on the bash-prompt will result in all
7272 Castle-files). Using `regular-expressions <https://en.wikipedia.org/wiki/Regular_expression>`__ is more powerfull, and
73-other used to highlight code; a pattern as `//.*$` can be used to highlight (single-line) comment. It often works, but
73+often used to highlight code; a pattern as ``//.*$`` can be used to highlight (single-line) comment. It often works, but
7474 this simple pattern might match a piece of text *inside* a multi-line-(doc)string -- which wrong.
75+|BR|
76+To parse a input-text its not a sound solution; although I have seen cunning regular-expressions, that almost always
77+work. But *reg-exps* have not the same power as a grammar-- That is already proven halve a century ago and will not be
78+repeated here.
7579
7680 Grammars are more powerfull
7781 ===========================
@@ -117,4 +121,4 @@
117121 But typically you proces/use that tree: like you do in many situations. Read the configuration values, walk over the
118122 tree, of traverse it as-if it is a DOM. You can even use Castle’s :ref:`matching-statements` to simply that.
119123
120-Grammars makes reading text easy. Define the structure, call the “main rule” and use the values. Castle make it simple.
124+Grammars makes reading text easy. Define the structure, call the “main rule” and use the values. Castle makes that simple!