<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rep.git/grammar/src/lib.rs, branch attempt1</title>
<subtitle>Parser generator for Emacs written in Rust
</subtitle>
<link rel='alternate' type='text/html' href='https://git.jsdurand.xyz/rep.git/'/>
<entry>
<title>new start</title>
<updated>2026-10-16T06:02:10+00:00</updated>
<author>
<name>JSDurand</name>
<email>mmemmew@gmail.com</email>
</author>
<published>2026-10-16T06:01:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.jsdurand.xyz/rep.git/commit/?id=fba9a90cfc6aca2a26cce72f55fb261789139781'/>
<id>fba9a90cfc6aca2a26cce72f55fb261789139781</id>
<content type='text'>
Now I tested and discussed with claude, and had a working version of
this project.  The rest is to port the claude version to my own
writings.  So this serves as the starting point before that attempt.

In the new attempt the design is better, and a number of bugs were
found and supposedly fixed, so let us see how this goes at the end.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now I tested and discussed with claude, and had a working version of
this project.  The rest is to port the claude version to my own
writings.  So this serves as the starting point before that attempt.

In the new attempt the design is better, and a number of bugs were
found and supposedly fixed, so let us see how this goes at the end.
</pre>
</div>
</content>
</entry>
<entry>
<title>grammar: cancel the plan of adding a range type</title>
<updated>2023-07-30T03:35:25+00:00</updated>
<author>
<name>JSDurand</name>
<email>mmemmew@gmail.com</email>
</author>
<published>2023-07-30T03:35:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.jsdurand.xyz/rep.git/commit/?id=a18887835bbb6d6c92c17bbf2d25f8825830a4d0'/>
<id>a18887835bbb6d6c92c17bbf2d25f8825830a4d0</id>
<content type='text'>
I think I should make a new sub-crate dedicated to the tokenization
process instead.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I think I should make a new sub-crate dedicated to the tokenization
process instead.
</pre>
</div>
</content>
</entry>
<entry>
<title>Derive Debug for a type</title>
<updated>2023-07-21T08:18:18+00:00</updated>
<author>
<name>JSDurand</name>
<email>mmemmew@gmail.com</email>
</author>
<published>2023-07-21T08:18:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.jsdurand.xyz/rep.git/commit/?id=31c78b6eb965200ad177aed7b8d31f74559fab8c'/>
<id>31c78b6eb965200ad177aed7b8d31f74559fab8c</id>
<content type='text'>
This makes it easier if I want to debug things.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This makes it easier if I want to debug things.
</pre>
</div>
</content>
</entry>
<entry>
<title>Finished the Emacs binding.</title>
<updated>2023-07-08T04:31:13+00:00</updated>
<author>
<name>JSDurand</name>
<email>mmemmew@gmail.com</email>
</author>
<published>2023-07-08T04:30:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.jsdurand.xyz/rep.git/commit/?id=9a317e56f8a6126583f7d0c431bf878d9b1fe7b1'/>
<id>9a317e56f8a6126583f7d0c431bf878d9b1fe7b1</id>
<content type='text'>
Now the binding part is finished.

What remains is a bug encountered when planting a fragment to the
forest which intersects a packed node, which would lead to invalid
forests.  This will also cause problem when planting a packed
fragment, but until now my testing grammars do not produce packed
fragments, so this problem is not encountered yet.

I am still figuring out efficient ways to solve this problem.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now the binding part is finished.

What remains is a bug encountered when planting a fragment to the
forest which intersects a packed node, which would lead to invalid
forests.  This will also cause problem when planting a packed
fragment, but until now my testing grammars do not produce packed
fragments, so this problem is not encountered yet.

I am still figuring out efficient ways to solve this problem.
</pre>
</div>
</content>
</entry>
<entry>
<title>review of previous bug fix</title>
<updated>2023-06-02T14:44:01+00:00</updated>
<author>
<name>JSDurand</name>
<email>mmemmew@gmail.com</email>
</author>
<published>2023-06-02T14:43:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.jsdurand.xyz/rep.git/commit/?id=6ce44bb3bdb79e8e727ee6fc7f5c6cd7fa0bb51e'/>
<id>6ce44bb3bdb79e8e727ee6fc7f5c6cd7fa0bb51e</id>
<content type='text'>
Generally speaking the algorithm now works correctly and produces the
right shape of forest for the test ambiguous grammar as well.  It does
not correctly perform the "reductions".  It seems that I deliberately
disabled this part of the functionalities in a previous debugging
tour.

So I have to enable it again and see if it works.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Generally speaking the algorithm now works correctly and produces the
right shape of forest for the test ambiguous grammar as well.  It does
not correctly perform the "reductions".  It seems that I deliberately
disabled this part of the functionalities in a previous debugging
tour.

So I have to enable it again and see if it works.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix a bug of duplication from planting after sploing</title>
<updated>2023-06-02T07:00:48+00:00</updated>
<author>
<name>JSDurand</name>
<email>mmemmew@gmail.com</email>
</author>
<published>2023-06-02T07:00:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.jsdurand.xyz/rep.git/commit/?id=8486474f377faf2d800d79166a7abe6b975e3e50'/>
<id>8486474f377faf2d800d79166a7abe6b975e3e50</id>
<content type='text'>
I should have staged and committed these changes separately, but I am
too lazy to deal with that.

The main changes in this commit are that I added the derive macro that
automates the delegation of the Graph trait.  This saves a lot of
boiler-plate codes.

The second main change, perhaps the most important one, is that I
found and tried to fix a bug that caused duplication of nodes.  The
bug arises from splitting or cloning a node multiple times, and
immediately planting the same fragment under the new "sploned" node.
That is, when we try to splone the node again, we found that we need
to splone, because the node that was created by the same sploning
process now has a different label because of the planting of the
fragment.  Then after the sploning, we plant the fragment again.  This
makes the newly sploned node have the same label (except for the clone
index) and the same children as the node that was sploned and planted
in the previous rounds.

The fix is to check for the existence of a node that has the same set
of children as the about-to-be-sploned node, except for the last one,
which contains the about-to-be-planted fragment as a prefix.  If that
is the case, treat it as an already existing node, so that we do not
have to splone the node again.

This is consistent with the principle to not create what we do not
need.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I should have staged and committed these changes separately, but I am
too lazy to deal with that.

The main changes in this commit are that I added the derive macro that
automates the delegation of the Graph trait.  This saves a lot of
boiler-plate codes.

The second main change, perhaps the most important one, is that I
found and tried to fix a bug that caused duplication of nodes.  The
bug arises from splitting or cloning a node multiple times, and
immediately planting the same fragment under the new "sploned" node.
That is, when we try to splone the node again, we found that we need
to splone, because the node that was created by the same sploning
process now has a different label because of the planting of the
fragment.  Then after the sploning, we plant the fragment again.  This
makes the newly sploned node have the same label (except for the clone
index) and the same children as the node that was sploned and planted
in the previous rounds.

The fix is to check for the existence of a node that has the same set
of children as the about-to-be-sploned node, except for the last one,
which contains the about-to-be-planted fragment as a prefix.  If that
is the case, treat it as an already existing node, so that we do not
have to splone the node again.

This is consistent with the principle to not create what we do not
need.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add a type Reducer for recording extra reductions</title>
<updated>2023-02-28T14:14:15+00:00</updated>
<author>
<name>JSDurand</name>
<email>mmemmew@gmail.com</email>
</author>
<published>2023-02-28T14:14:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.jsdurand.xyz/rep.git/commit/?id=b306fe88edcb3d7c7628e155f67fd7e1c8c29c19'/>
<id>b306fe88edcb3d7c7628e155f67fd7e1c8c29c19</id>
<content type='text'>
In the chain-rule machine, we need to skip through edges whose labels
are "accepting", otherwise the time complexity will be high even for
simple grammars.  This implies that we will skip some "jumping up" in
the item derivation forest.  So we need to record these extra jumping
up, in order to jump up at a later point.

This Reducer type plays this role.  But I still need more experiments
to see if this approach works out as I intended.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In the chain-rule machine, we need to skip through edges whose labels
are "accepting", otherwise the time complexity will be high even for
simple grammars.  This implies that we will skip some "jumping up" in
the item derivation forest.  So we need to record these extra jumping
up, in order to jump up at a later point.

This Reducer type plays this role.  But I still need more experiments
to see if this approach works out as I intended.
</pre>
</div>
</content>
</entry>
<entry>
<title>before a major refactor</title>
<updated>2023-02-27T04:36:41+00:00</updated>
<author>
<name>JSDurand</name>
<email>mmemmew@gmail.com</email>
</author>
<published>2023-02-27T04:36:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.jsdurand.xyz/rep.git/commit/?id=fbaa420ed550e9c3e7cdc09d4a8ec22bfbd782a6'/>
<id>fbaa420ed550e9c3e7cdc09d4a8ec22bfbd782a6</id>
<content type='text'>
I decide to adopt a new approach of recording and updating item
derivation forests.  Since this affects a lot of things, I decide to
commit before the refactor, so that I can create a branch for that
refactor.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I decide to adopt a new approach of recording and updating item
derivation forests.  Since this affects a lot of things, I decide to
commit before the refactor, so that I can create a branch for that
refactor.
</pre>
</div>
</content>
</entry>
<entry>
<title>Added the functionality of split or clone.</title>
<updated>2023-02-12T04:07:34+00:00</updated>
<author>
<name>JSDurand</name>
<email>mmemmew@gmail.com</email>
</author>
<published>2023-02-12T04:07:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.jsdurand.xyz/rep.git/commit/?id=987c84f3454c687cca0efe0d471fcf00e052ecab'/>
<id>987c84f3454c687cca0efe0d471fcf00e052ecab</id>
<content type='text'>
I need more than the ability to clone nodes: I also need to split the
nodes.  Now this seems to be correctly added.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I need more than the ability to clone nodes: I also need to split the
nodes.  Now this seems to be correctly added.
</pre>
</div>
</content>
</entry>
<entry>
<title>Finally produced the first correct forest</title>
<updated>2023-02-03T02:52:35+00:00</updated>
<author>
<name>JSDurand</name>
<email>mmemmew@gmail.com</email>
</author>
<published>2023-02-03T02:52:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.jsdurand.xyz/rep.git/commit/?id=265ff8f87dc7392fdf701f811eb2bf54d7bc6678'/>
<id>265ff8f87dc7392fdf701f811eb2bf54d7bc6678</id>
<content type='text'>
Finally the prototype parser has produced the first correct forest.
It is my first time to generate a correct forest, in fact, ever since
the beginning of this project.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Finally the prototype parser has produced the first correct forest.
It is my first time to generate a correct forest, in fact, ever since
the beginning of this project.
</pre>
</div>
</content>
</entry>
</feed>
