• R/O
  • SSH

提交

标签
No Tags

Frequently used words (click to add to your profile)

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

Commit MetaInfo

修订版f4b3918f3419cf36e1627d4212ca3d1cc96d64bf (tree)
时间2023-05-23 04:19:49
作者Albert Mietus < albert AT mietus DOT nl >
CommiterAlbert Mietus < albert AT mietus DOT nl >

Log Message

Grammerly

更改概述

差异

diff -r 865669d7dc68 -r f4b3918f3419 CCastle/1.Usage/1.CompilerCompiler.rst
--- a/CCastle/1.Usage/1.CompilerCompiler.rst Mon May 22 20:46:46 2023 +0200
+++ b/CCastle/1.Usage/1.CompilerCompiler.rst Mon May 22 21:19:49 2023 +0200
@@ -11,8 +11,8 @@
1111 :category: Castle, Usage
1212 :tags: Castle, Grammar
1313
14- In Castle, you can define *grammar*(s) directly in your code. The compiler will *translate* them into functions, using
15- the build-in (PEG) **compiler-compiler** -- at least that was it called back in the days of *YACC*.
14+ In Castle, you can define *grammar(s)* directly in your code. A Castle compiler will **translate** them into
15+ functions, using the build-in (PEG) *compiler-compiler* -- at least that was it called back in the days of *YACC*.
1616
1717 How does one *use* that? And *why* should you?
1818
@@ -20,8 +20,8 @@
2020 Grammars, a short intro
2121 =======================
2222
23-A grammar is a collection of (parsing)-**rules** and optionally some *settings*. Rules are written in a mixture of EBNF
24-and PEG meta-syntax. Let’s start with a simple example:
23+A grammar is a collection of (parsing)-**rules** and some optional *settings*. Let us start with a simple example with
24+some rules written in a mixture of EBNF and PEG meta-syntax.
2525
2626 .. code-block:: PEG
2727
@@ -42,7 +42,7 @@
4242 programming. Some terminals are like constants like the semicolon at the end of ``import_line``, therefore they are
4343 quoted in the grammar (Notice, the is also a non-quoted semicolon on each line, which is part of the syntax of grammar.)
4444 |BR|
45-Other terminals are more like valuables, they have a value. The ``STRING_literal`` is a good example. Its value is the
45+Other terminals are more like variables, they have a value. The ``STRING_literal`` is a good example. Its value is the
4646 string itself. Similar for numbers and variable names.
4747
4848 In this (example) grammar, a ``qualID`` is a ``nameID`` *(a name that is used as ID, like in any programming language)*,
@@ -52,7 +52,7 @@
5252
5353 A grammar defines how one (aka the compiler) should read the input --a text--, or more formally: how to parse it. The
5454 result of this parsing is twofold. It will check whether the input conforms to the grammar; resulting in a boolean, for
55-the mathematics under us. And it will translate a sequential (flat) text into a tree-structure; which is typically much
55+the mathematics under us. And it will translate a sequential (flat) text into a tree structure; which is typically much
5656 more useful for a software engineer.
5757 |BR|
5858
@@ -80,25 +80,25 @@
8080 Non-parsing
8181 -----------
8282
83-As writing a proper-passer used to be (too) hard, other similar (but simpler) techniques are often used, like `globing
83+As writing a proper parser used to be (too) hard, other similar (but more simple) techniques are often used, like `globing
8484 <https://en.wikipedia.org/wiki/Glob_(programming)>`__ *(``\*.Castle`` on the bash-prompt will result in all
85-Castle-files)*. This is simple and will do in very simple cases.
85+Castle-files)*. It is elementary and will do in simple cases.
8686 |BR|
8787 Others try to use `regular expressions <https://en.wikipedia.org/wiki/Regular_expression>`__ for parsing. RegExps are
88-indeed more powerful than globing and are often used to highlight code. A pattern as ``//.*$`` can be used to highlight
88+indeed more powerful than globing. They are often used to highlight code. A pattern as ``//.*$`` can be used to highlight
8989 (single-line) comments. It often works, but this simple pattern might match a piece of text *inside* a
9090 multi-line-(doc)string -- which is wrong.
9191
9292 Those *tricks* aren’t a sound solution to parse generic input/text; although I have seen cunning RegExps that almost
9393 (always) work. *Regular expressions* do have not the same power as grammars; that is already proven half a century
94-ago and not repeated here.
94+ago and is not repeated here.
9595
9696 Grammars are more powerful
9797 ==========================
9898
99-A grammar (even a simple one) is more powerful. You can define the overall structure of the input and the sub-structure
100-of each *lump*. When a multi-line-string has no sub-structure, the parser will never find comments inside it. Nor the other
101-way around; it simply is not hunting for it.
99+A grammar (even a simple one) is more powerful. You can define the (input) structure hierarchically. And specify the
100+sub-structure of each *lump*. For example: when a multi-line-string has no sub-structure, the parser will never find
101+a statement inside it; it simply is not hunting for it.
102102
103103 As most programming languages do not have built-in support for grammars, one has to resort to external tools. Like the
104104 famous `YACC <https://en.wikipedia.org/wiki/Yacc>`__; developed in 197X. YACC will read a grammar-file and generates
@@ -150,7 +150,7 @@
150150 parsing strategy; it should support PEG. But it is free to support others as well (with user-selectable
151151 compiler-plugins).
152152 |BR|
153- This is not unlike other compiler-options.
153+ This is not unlike other compiler options.
154154
155155 To use the grammar, you simply call one of those rules as a function: pass the input (string) and it will return a
156156 (generic) tree structure.
diff -r 865669d7dc68 -r f4b3918f3419 CCastle/4.Blog/a.Heisenbug.rst
--- a/CCastle/4.Blog/a.Heisenbug.rst Mon May 22 20:46:46 2023 +0200
+++ b/CCastle/4.Blog/a.Heisenbug.rst Mon May 22 21:19:49 2023 +0200
@@ -11,7 +11,7 @@
1111 :tags: Castle, DRAFT
1212
1313 In Castle, one can dynamically connect components and send “events” over those connections. Typically this is done as
14- an action on an incoming message (see: :ref:`CCC-Actors`). And, depending on ‘:ref:`TheMachinery`’ those events can be
14+ an action on an incoming message (see: :ref:`CCC-Actors`). And depending on ‘:ref:`TheMachinery`’, those events can be
1515 queued. It is this combination that *can result* in a **beautiful Heisenbug**.
1616
1717 First, let’s explain the Heisenbug, before we give an example. Then we analyze it, show how to improve the code, and
@@ -34,14 +34,14 @@
3434 My standard example, :ref:`Castle-TheSieve`, suffered from this issue. The initial version did work for years
3535 but failed horribly when another “machinery” was used. After studying this, the bug is simple and easy to fix.
3636
37-There are two related timing issues that together result in the Heisenbug. First, we introduce them, and then
37+There are two related timing issues that together result in the Heisenbug. First, we introduce them and then
3838 show how the combination may fail.
3939
4040
4141 Event-order
4242 -----------
4343
44-Conceptually, the `Generator` sends (events with) integers to `Sieve(2)`, which may forwarded them to `Sieve(3)`, then
44+Conceptually, the `Generator` sends (events with) integers to `Sieve(2)`, which may forward them to `Sieve(3)`, then
4545 to `Sieve(5)`, etc. As shown in the **Conceptual sidebar**, we probably like to assume that each integer is sieved
4646 before the next *’int’* *starts*: the classic “sequential view” we are used to.
4747
@@ -203,7 +203,7 @@
203203 Remember, this queue exists as a *model* **only** (like everything in Castle-code)!
204204 |BR|
205205 Depending on ‘:ref:`TheMachinery`, there may be no need to implement the queue (e.g.with DirectCall) at all; or they may
206- only be a queue-length and -maximum, or ...
206+ only be a queue length and -maximum, or ...
207207
208208
209209