summaryrefslogtreecommitdiff
path: root/src/grammar.c
AgeCommit message (Collapse)Author
2022-02-08fix errorsHEADmasterJSDurand
There are multiple subtle errors in the previous version, both in the codes and in the description of the BNF format. This version should fix some problems now. This version can successfully parse the grammar of its own grammar format, which is quite nice. See test/check_reader.c for parsing this format.
2022-02-05predicates start working nowJSDurand
Now we have a working implementation of predicates. It now only remains to write the parser of grammars. Of course we shall generate this parser by this parser generator itself, because why not. ;-P
2022-02-05replace some hash table usage by tuplesJSDurand
Previously I used hash tables, which consume too much memory. Now the critical parts are replaced by a new hand-written library called "tuple.h". Now we can easily parse larger inputs. I haven't tested its limits, though.
2022-02-01need to stop abusing hash tablesJSDurand
Hash tables take too much space! If I use hash tables, the length of the input will be severely limited, to an unacceptable extent. So we have to use arrays instead.
2022-01-31cnp: save pointJSDurand
Now we need to implement predicates, in order to have practical applications.
2022-01-31test/check_cnp: working algorithmJSDurand
I now have a working algorithm in test/check_cnp. It can correctly parse the grammar for an esoteric language called "Brainfuck". This language does not matter. What matters is that it contains parentheses. So this shows that at least for grammars as complex as parentheses, this parser works well. Haha.
2022-01-28BSRJSDurand
A prototype of BSR is roughly finished.
2022-01-22Implemented a hash table with any type of keysJSDurand
2022-01-21temporary save pointJSDurand
Just to save some work.
2022-01-12Implement a simple hash table.JSDurand
It is a very basic and simple hash table. It is so simple that I hesitate to call it a hash table. Anyways, I think it suffices for my purposes here. * Makefile.am: Add necessary files. * grammar.c (new_tnt_string): Formatting. * ht.c (new_ht): Constructor (destroy_ht): Destructor (ht_expand): Rehash (ht_insert, ht_delete, ht_find): Main functions. * list.c (add_to_list, list_assure_size): Modify the use of realloc. * test/check_ht.c: Ensure this is working correctly. * util.c (read_entire_file): Modify the use of realloc.
2022-01-11Add the framework for character classes.JSDurand
Now we have the potential to recognize character classes. But the most important task for us now is to experiment with ((B)RN)GLR algorithms, so we leave the character classes at the present state for a moment.
2022-01-04Fix problemsJSDurand
Now some problems are fixed. It can now read grammar correctly (hopefully) from a file, in the BNF format. And strings (terminals) are handled fine as well. So glad that there are no leak problems now.
2022-01-04temporary commitJSDurand
Now we can read grammars from a file. But we need to check if it works for reading strings still.
2021-11-09save point: representation of grammar might be too rough.JSDurand
The current representation of the grammar is the most primitive BNF. This is the simplest to implement, but is difficult to cope with user requirements. Moreover, I find another paper describing the GLR algorithm, so I need to think about the representation of the grammar more. In particular, I would like the generation of the grammar to be incremental, so per chance its data type should be adapted accordingly.
2021-11-08initial commitJSDurand
Now the rough framework is established and the grammar class is sort of ready. It remains to write a general input reading mechanism.