summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-08-10Add an example 'bfinterp'HEADmasterJSDurand
My plan is to build a little interpreter for an esoteric programming language as the most basic application of this package, before embarking on some more ambitious applications.
2023-08-10Modify READMEJSDurand
Working my way towards a user-friendly introduction to the package.
2023-08-10Move the trait `Forest` to the crate "forest".JSDurand
The purpose of this change is to share this trait with other crates, such as the forth-coming "semiring" crate that will be responsible for handling some simple semiring operations as well as the querying, in my plans.
2023-08-09Fix a bug of using incorrect forest nodes to plant.JSDurand
Previously some incorrect forest nodes will be used for planting new nodes. I cannot fix the root cause of their presence in the chain-rule machine. But I can ignore them when they are encountered. Of course I would like to really prevent them from existing, but still cannot figure out how.
2023-08-05bump version: 0.1.3JSDurand
* Cargo.toml * chain/Cargo.toml * grammar/Cargo.toml: Bump version. * ChangeLog: Add a short description of the bug fix introduced in this version.
2023-08-04add a crate 'tokens'JSDurand
This crate is responsible for the users to conveniently define their own tokenizers. Right now the user has to tokenize the input string manually, which is not quite what is expected from a parser, from the view point of users.
2023-08-04minor adjustmentsJSDurand
Not bug deals but adjustments of details.
2023-08-04splone: fix the bug of finding the wrong nodeJSDurand
* chain/src/item/default/splone.rs: A function for finding the node to plant used to ignore the condition that the children should match. Now this is fixed.
2023-08-04chain/item: Make some function publicJSDurand
* chain/src/item/mod.rs: Some function and enum are needed across crates.
2023-08-04chain/atom/default: Fix nullibility of virtual nodes.JSDurand
* chain/src/atom/default.rs: Previously the nullibility of virtual nodes is determined by the nullibility of all its out-going edges. This is now determined only by the nullibility of out-going edges that are not "left-linearly expanded". This is the correct approach.
2023-08-04chain/default: Add funtion `print_current`JSDurand
* chain/src/default.rs: This is useful for debugging the chain-rule machine.
2023-08-01Fix some bugsJSDurand
Some bugs are fixed: 1. If a non-terminal expansion can be reduced immediately, previously an extra node would be created that had no parents. Now this strange behaviour is corrected. 2. When performing reductions, a leaf non-terminal node would previously be regarded as completed. Now we will first try to complete that node, and then determine if the completion is successful, and finally determine the completedness according to the result. Of course some more tests are still pending, before I can confirm that no more bugs lurk around.
2023-07-30chain/default.rs: Minor adjustment and add a planJSDurand
Adjust the codes slightly. Also add a plan to implement the context-free memoization.
2023-07-30DIARY: Add more thoughtsJSDurand
2023-07-30update READMEJSDurand
Use a better formatting style.
2023-07-30Fix makefile's.JSDurand
Fix the broken Makefiles.
2023-07-30grammar: cancel the plan of adding a range typeJSDurand
I think I should make a new sub-crate dedicated to the tokenization process instead.
2023-07-22Add some auxiliary data.JSDurand
Try to fix some minor issues.
2023-07-22Add experimental python scripts for debuggingJSDurand
* chain/src/item/default/printer.lldb: * chain/src/item/default/printer.py: These are for experimenting with debugger supports.
2023-07-21Print graphs with edges in orderJSDurand
* chain/src/item/default/mod.rs: * graph/src/labelled/binary.rs: * graph/src/labelled/double.rs: * graph/src/lib.rs: If we set the option "ordering" to be "out" in the declaration of nodes at the beginning, then GraphViz will not change the order of children out of nodes. This is much better looking in my opinion. * INSTALL: make insists in changing this file, so let it be.
2023-07-21Bump version number to 0.1.20.1.2JSDurand
I have fixed another bug and think that the version of a more stable version is worth bumping the versions for.
2023-07-21Add variations to the testJSDurand
Add an intentionally ambiguous grammar for testing purposes. It seems to work fine.
2023-07-21regex: Merge the `types` array as well.JSDurand
* nfa/src/default/regex.rs: Previously when merging regular expressoins, only the graphs are merged, but the `types` array stayed unchanged. This caused errors of indices being out of bounds.
2023-07-21abnf: Correct error reportsJSDurand
Previously the errors emitted while reading abnf grammars reported incorrect indices. Now this is fixed.
2023-07-21Derive Debug for a typeJSDurand
This makes it easier if I want to debug things.
2023-07-21Add a rule to compile the Rust partJSDurand
2023-07-21Add a change log to celebrate.0.1.1JSDurand
2023-07-21bump versionJSDurand
This bumping of version is insignificant. I just find it notable that I seem to finally obtain a version without trivial bugs. Hooray!
2023-07-21chain/default: Remove the annoying node whenever plausible.JSDurand
The chain-rule machine needs a place-holder node at the beginning. But afterwards that node is pure annoyance and disturbs the functioning of the machine. Consequently I removed that node whenever the right time comes. This seems to fix some other bugs. It is reasonable: the presence of that bogus node is just noise to the machine and error-prone.
2023-07-21chain/atom/default: add a function to print virtual nodes.JSDurand
* chain/src/atom/default.rs (print_virtual): Previously printing virtual nodes is done inside the function `print_nfa`; now this is decoupled and thus more flexible.
2023-07-21genins: Use relative file path for printing forests.JSDurand
* chain/src/item/genins.rs: The absolute path is too long and unnecessary.
2023-07-21grammar/label: `set_end_option`JSDurand
* grammar/src/label.rs (set_end_option): This function replaces the old function `open_end`, as this new function is more general than the old one, and there is no specific situation where we only need to open the end of a node without the need to close the node in an `if` statement.
2023-07-21splone: splitting parents properly.JSDurand
* chain/src/item/default/splone.rs: Previouslt the function `split_node` used to split the parents of splitted nodes by an ugly logic. Now that is moved into a dedicated function, which properly handles the splitting of parents, including the case when the new node is open whereas the old node is closed, in which situation we ought to put the new node under the opened node only, as a closed node cannot contain an open node as a child by definition.
2023-07-21make changes install file for some reasonJSDurand
Huh.
2023-07-19graph: Add a future plan.JSDurand
* graph/src/lib.rs: Add a plan to reduce the number of bounds-checking. Hopefully this makes the package more efficient.
2023-07-19chain/atom/default: Make `print_nullables` public.JSDurand
* chain/src/atom/default.rs: Making this function public means I do not have to worry about it being unused.
2023-07-19genins: Fix the bug of forgetting to set ending positions.JSDurand
Previously a virtual fragment did not receive proper ending positions. This is now fixed. Additionally, after this fix, the function `set_pos` is only called with the last parameter set to `t`. Maybe I shall remove this parameter.
2023-07-19grammar/abnf: Fix a bug of repeatedly adding non-terminalsJSDurand
This bug caused a plain unambiguous grammar to become ambiguous. Funnily enough, this bug revealed a lot of bugs in the code for handling forests. I guess this is an unexpected surprise. :D
2023-07-18chain/src/item/default/mod.rs: Add a unit test for `set_pos`JSDurand
The function `set_pos` is kind of subtle and its behaviour needs a unit test so that we can be sure that it does not accidentally set the ending positions in a careless manner.
2023-07-18Fix the bug of incorrectly setting the end of forest nodesJSDurand
Previously when generating a fragment of the forest corresponding to the expansion of a non-terminal by a terminal, we incorrectly set the end of every node within it to be one plus the start, if the expansion happens due to a reduction. Now this mistake is fixed and the ending positions are correctly set.
2023-07-18chain/src/atom/default.rs: Add function to print nullablesJSDurand
* chain/src/atom/default.rs (print_nullables): This functions prints the nullables nodes of an atomic language. This is useful whe designing unit tests, as it enables us to know which rule positions are considered accepting by the underlying testing atomic language.
2023-07-18Fix a bug of unnecessarily cloning nodes.JSDurand
* chain/src/item/default/splone.rs: Previously when we split nodes, we always clone the parent if the labels differ. This turns out to be incorrect if the new label is open whereas the old label is closed. In that case, the old parent should not contain the new node as a child, as a closed node should not contain an open node. I am not yet entirely sure this fix is correct, so more test await us.
2023-07-18test.c: Save the forest to a file.JSDurand
This is not of much use right now, but can be helpful later.
2023-07-16Fix the bug of forgetting to check cloned nodes.JSDurand
In the process of splitting, cloning, and planting the forest, I forgot to check whether some cloned node of the node inquestion satisfy the condition. This used to cause forests that violate some fundamental assumptions. Now this is supposed to be fixed, but more tests await us.
2023-07-15test.c: I forgot to check if a malloc fails.JSDurand
* src/test.c: input is a malloc'ed pointer, which can be NULL due to malloc not being able to allocate enough memory. So I have to guard against this possibility. Aside: Why are some intermediate files added again?
2023-07-13genins: stop printing files if the directory does not existJSDurand
2023-07-13helper.h: delete a duplicated declarcationJSDurand
2023-07-13remove intermediate filesJSDurand
Those were added by accident.
2023-07-13Add config for cross-compilationJSDurand
2023-07-12Fix the bug of testing prefixes and plantingJSDurand
Previously the functions `is_prefix` and `plant` did not take the situation of packed nodes into considerations. That was because I only dealt with non-packed nodes in the past: the fragment to test for prefixes and for planting did not intersect the packed nodes in the forest, and the grammar is so simple that the fragments do not contain packed nodes. Then a test revealed this situation, so I have to fix this lack of considerations now. This commit attempts to fix this issue. From the newly added unit-tests, it seems that this fix works. :)