cascardo/grammar.git
18 years agoFixed assertion in first
Thadeu Lima de Souza Cascardo [Thu, 27 Oct 2005 00:00:36 +0000 (00:00 +0000)]
Fixed assertion in first

The implementation assumed there would be no rules starting with
terminals since they were eliminated at the first chance. However, rules
starting with a non-terminal which produced the empty string followed by
a terminal were added to the set of rules.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--nogobject-lr1--0.1--patch-10

18 years agoFixed grammar loading scanner
Thadeu Lima de Souza Cascardo [Wed, 26 Oct 2005 23:45:57 +0000 (23:45 +0000)]
Fixed grammar loading scanner

The scanner for grammar loading did not read input when it has reached
the end of the buffer unless the last token finished in the end of the
buffer.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--nogobject-lr1--0.1--patch-9

18 years agoUpdated from branch dev
Thadeu Lima de Souza Cascardo [Wed, 26 Oct 2005 12:43:18 +0000 (12:43 +0000)]
Updated from branch dev

Patches applied:

 * cascardo@tlscascardo--private/libgrammatic--dev--0.1--patch-22
   Added scanner module and fixed BNF dependency on it

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--nogobject-lr1--0.1--patch-8

18 years agoAdded scanner module and fixed BNF dependency on it
Thadeu Lima de Souza Cascardo [Wed, 26 Oct 2005 12:38:47 +0000 (12:38 +0000)]
Added scanner module and fixed BNF dependency on it

Scanner module was added, with no default scanner. BNF dependency on it
was fixed, providing its own scanner function.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--dev--0.1--patch-22

18 years agoUpdate to branch lr1
Thadeu Lima de Souza Cascardo [Wed, 26 Oct 2005 12:28:51 +0000 (12:28 +0000)]
Update to branch lr1

Patches applied:

 * cascardo@tlscascardo--private/libgrammatic--lr1--0.1--patch-6
   Fixed some building issues

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--nogobject-lr1--0.1--patch-7

18 years agoFixed some building issues
Thadeu Lima de Souza Cascardo [Wed, 26 Oct 2005 12:26:28 +0000 (12:26 +0000)]
Fixed some building issues

Fixed some building issues, related to headers.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--lr1--0.1--patch-6

18 years agoUpdated branch nogobject
Thadeu Lima de Souza Cascardo [Wed, 26 Oct 2005 12:22:18 +0000 (12:22 +0000)]
Updated branch nogobject

Patches applied:

 * cascardo@tlscascardo--private/libgrammatic--nogobject--0.1--patch-4
   Fixed some conversion issues

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--nogobject-lr1--0.1--patch-6

18 years agoFixed some conversion issues
Thadeu Lima de Souza Cascardo [Wed, 26 Oct 2005 12:20:31 +0000 (12:20 +0000)]
Fixed some conversion issues

Some modifications were not properly done. Besides some mistyping, some
variable names were not properly changed.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--nogobject--0.1--patch-4

18 years agoPushing on lr1 stack is now public
Thadeu Lima de Souza Cascardo [Mon, 24 Oct 2005 00:03:50 +0000 (00:03 +0000)]
Pushing on lr1 stack is now public

LR(1) parser should have an arbritary initial state. Then, pushing to its
stack is now public.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--nogobject-lr1--0.1--patch-5

18 years agoUpdate with lr1 branch
Thadeu Lima de Souza Cascardo [Sun, 23 Oct 2005 23:40:44 +0000 (23:40 +0000)]
Update with lr1 branch

Patches applied:

 * cascardo@tlscascardo--private/libgrammatic--lr1--0.1--patch-5
   Added header to item collection building

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--nogobject-lr1--0.1--patch-4

18 years agoAdded header to item collection building
Thadeu Lima de Souza Cascardo [Sun, 23 Oct 2005 23:39:30 +0000 (23:39 +0000)]
Added header to item collection building

LR(1) item collection building has a header which exports the item
structure and the function which build the collection.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--lr1--0.1--patch-5

18 years agomerge with lr1 branch
Thadeu Lima de Souza Cascardo [Sun, 23 Oct 2005 22:28:36 +0000 (22:28 +0000)]
merge with lr1 branch

Patches applied:

 * cascardo@tlscascardo--private/libgrammatic--lr1--0.1--patch-4
   Item collection building returns the collection

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--nogobject-lr1--0.1--patch-3

18 years agoItem collection building returns the collection
Thadeu Lima de Souza Cascardo [Sun, 23 Oct 2005 22:26:18 +0000 (22:26 +0000)]
Item collection building returns the collection

Function that builds the item collection returns it instead of simply
destroying it.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--lr1--0.1--patch-4

18 years agoUpdate with lr1 branch
Thadeu Lima de Souza Cascardo [Sun, 23 Oct 2005 17:26:49 +0000 (17:26 +0000)]
Update with lr1 branch

Patches applied:

 * cascardo@tlscascardo--private/libgrammatic--lr1--0.1--patch-2
   Added LR1 Parsing Algorithm

 * cascardo@tlscascardo--private/libgrammatic--lr1--0.1--patch-3
   Added LR1 Parsing Algorithm

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--nogobject-lr1--0.1--patch-2

18 years agoAdded LR1 Parsing Algorithm
Thadeu Lima de Souza Cascardo [Sun, 23 Oct 2005 17:17:46 +0000 (17:17 +0000)]
Added LR1 Parsing Algorithm

LR(1) parsing algorithm is added to the library.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--lr1--0.1--patch-3

18 years agoAdded LR1 Parsing Algorithm
Thadeu Lima de Souza Cascardo [Sun, 23 Oct 2005 17:17:46 +0000 (17:17 +0000)]
Added LR1 Parsing Algorithm

LR(1) parsing algorithm is added to the library.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--lr1--0.1--patch-2

18 years agoMerge nobobject with LR1
Thadeu Lima de Souza Cascardo [Thu, 20 Oct 2005 21:45:30 +0000 (21:45 +0000)]
Merge nobobject with LR1

Patches applied:

 * cascardo@tlscascardo--private/libgrammatic--lr1--0.1--base-0
   tag of cascardo@tlscascardo--private/libgrammatic--dev--0.1--patch-18

 * cascardo@tlscascardo--private/libgrammatic--lr1--0.1--patch-1
   LR1 Items with lookahead instead of LR0 items

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--nogobject-lr1--0.1--patch-1

18 years agomemory leak at bnf loader cascardo@tlscascardo--private,libgrammatic--nogobject-lr1--0.1--base-0
Thadeu Lima de Souza Cascardo [Fri, 7 Oct 2005 15:48:21 +0000 (15:48 +0000)]
memory leak at bnf loader

BNF Loader did not release memory for the grammar and parser.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--nogobject--0.1--patch-3

18 years agoRemoved GObject support from RDP
Thadeu Lima de Souza Cascardo [Fri, 7 Oct 2005 15:46:50 +0000 (15:46 +0000)]
Removed GObject support from RDP

Recursive Descent Parser no longer inherits from Grammar. It is not a
GObject any more.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--nogobject--0.1--patch-2

18 years agoRemoved GObject support from grammar
Thadeu Lima de Souza Cascardo [Fri, 7 Oct 2005 15:39:25 +0000 (15:39 +0000)]
Removed GObject support from grammar

Removed GObject support from grammar type.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--nogobject--0.1--patch-1

18 years agoLittle fix in bnf header cascardo@tlscascardo--private,libgrammatic--nogobject--0.1--base-0
Thadeu Lima de Souza Cascardo [Fri, 7 Oct 2005 15:29:44 +0000 (15:29 +0000)]
Little fix in bnf header

#endif in bnf header was given a macro.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--dev--0.1--patch-21

18 years agoAdded grammar file description loader
Thadeu Lima de Souza Cascardo [Fri, 7 Oct 2005 15:12:16 +0000 (15:12 +0000)]
Added grammar file description loader

Grammar File Description Loader, bnf.c, is added. It reads a file which
contains a description of a grammar and returns the grammar.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--dev--0.1--patch-20

18 years agoState numbers are not defined in items modules
Thadeu Lima de Souza Cascardo [Mon, 3 Oct 2005 00:27:20 +0000 (00:27 +0000)]
State numbers are not defined in items modules

Do not define state numbers for each item set. Instead, let the goto
point to another key in the hash table, so they can uniquely be
referenced by their memory address. Any other code can associate any
state number it finds more suitable.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--dev--0.1--patch-19

18 years agoLR1 Items with lookahead instead of LR0 items cascardo@tlscascardo--private,libgrammatic--merge--0.1--base-0
Thadeu Lima de Souza Cascardo [Sun, 2 Oct 2005 19:36:51 +0000 (19:36 +0000)]
LR1 Items with lookahead instead of LR0 items

Replaced LR(0) with LR(1) with a lookahead in the items and a new closure
function, and a first hash table used to calculate it.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--lr1--0.1--patch-1

18 years agoConflict symbols are now static cascardo@tlscascardo--private,libgrammatic--lr1--0.1--base-0
Thadeu Lima de Souza Cascardo [Sun, 2 Oct 2005 19:09:20 +0000 (19:09 +0000)]
Conflict symbols are now static

When linking first and item, a symbol conflict for the function for
getting a list from the keys in a hash. They are static now, which solves
the problem.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--dev--0.1--patch-18

18 years agoFixed bug in items related to the comparison of set items
Thadeu Lima de Souza Cascardo [Fri, 30 Sep 2005 15:29:08 +0000 (15:29 +0000)]
Fixed bug in items related to the comparison of set items

The comparison of set items did not work with g_hash_table_find because
hash values were all NULL. Putting the keys in a list and, then,
iterating through it fixed the problem.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--dev--0.1--patch-17

18 years agoFixed code for printing item sets
Thadeu Lima de Souza Cascardo [Thu, 29 Sep 2005 17:51:56 +0000 (17:51 +0000)]
Fixed code for printing item sets

Fixed some littel code for the debugging of the computing of item sets.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--dev--0.1--patch-16

18 years agoFixed code in grammar for comparing rules
Thadeu Lima de Souza Cascardo [Thu, 29 Sep 2005 17:36:10 +0000 (17:36 +0000)]
Fixed code in grammar for comparing rules

A little mistyping in the code for comparing rules.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--dev--0.1--patch-15

18 years agoAdded debug code to item generation
Thadeu Lima de Souza Cascardo [Thu, 29 Sep 2005 17:31:50 +0000 (17:31 +0000)]
Added debug code to item generation

Code to print item sets was added to item.c.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--dev--0.1--patch-14

18 years agoAdded file to compute LR(0) collection of item sets
Thadeu Lima de Souza Cascardo [Thu, 29 Sep 2005 17:09:52 +0000 (17:09 +0000)]
Added file to compute LR(0) collection of item sets

item.c file contains functions and data types that allow the
representation and building of a collection of item sets. Those include
the CLOSURE and GOTO functions.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--dev--0.1--patch-13

18 years agoAdded functions to compare symbols and hash and equal for rules
Thadeu Lima de Souza Cascardo [Thu, 29 Sep 2005 03:31:26 +0000 (03:31 +0000)]
Added functions to compare symbols and hash and equal for rules

Functions to compare two symbols and two rules were added. Also functions
for hashing a rule, including equal and hash functions.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--dev--0.1--patch-12

18 years agoAdded function to get first from sequence of grammar symbols
Thadeu Lima de Souza Cascardo [Thu, 29 Sep 2005 03:09:51 +0000 (03:09 +0000)]
Added function to get first from sequence of grammar symbols

Function first_rule returns a list with all the symbols in first of a
rule or sequence of grammar symbols.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--dev--0.1--patch-11

18 years agoFixed code in first
Thadeu Lima de Souza Cascardo [Thu, 29 Sep 2005 03:05:45 +0000 (03:05 +0000)]
Fixed code in first

Code to get first list was incorrect.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--dev--0.1--patch-10

18 years agoFixed the code to build a list from keys of a hashtable
Thadeu Lima de Souza Cascardo [Thu, 29 Sep 2005 03:02:48 +0000 (03:02 +0000)]
Fixed the code to build a list from keys of a hashtable

Fixed the code that built a list from the keys of a hash table.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--dev--0.1--patch-9

18 years agoCompute first set of a grammar
Thadeu Lima de Souza Cascardo [Wed, 28 Sep 2005 05:05:20 +0000 (05:05 +0000)]
Compute first set of a grammar

Compute the first set for every nonterminal of the grammar.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--dev--0.1--patch-8

18 years agoChanged symbol value to GQuark
Thadeu Lima de Souza Cascardo [Wed, 28 Sep 2005 05:04:23 +0000 (05:04 +0000)]
Changed symbol value to GQuark

Symbol value is now a GQuark, so it has a string identifier as well as a
numeric value.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--dev--0.1--patch-7

18 years agoRecursive Descent Parser GObjectified
Thadeu Lima de Souza Cascardo [Sun, 25 Sep 2005 12:47:49 +0000 (12:47 +0000)]
Recursive Descent Parser GObjectified

Recursive Descent Parser code adapted to the new Grammar code and
GObjectified.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--dev--0.1--patch-6

18 years agopublic and copy rule and symbol functions
Thadeu Lima de Souza Cascardo [Fri, 23 Sep 2005 02:42:44 +0000 (02:42 +0000)]
public and copy rule and symbol functions

Some rule and symbol functions are public. Copy functions for both are
also provided.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--dev--0.1--patch-5

18 years agoProvide functions to retrieve rules from Grammar
Thadeu Lima de Souza Cascardo [Sat, 17 Sep 2005 18:27:44 +0000 (18:27 +0000)]
Provide functions to retrieve rules from Grammar

Functions to retrieve rules for a symbol and symbols from a rule are
provided.

--This line, and those below, will be ignored--
Files to commit:
   <can't compute list>

This list might be incomplete or outdated if editing the log
message was not invoked from an up-to-date changes buffer!

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--dev--0.1--patch-4

18 years agoProperly delete Grammar hashtable content
Thadeu Lima de Souza Cascardo [Sat, 17 Sep 2005 15:25:59 +0000 (15:25 +0000)]
Properly delete Grammar hashtable content

Grammar hashtable content is properly freed.

--This line, and those below, will be ignored--
Files to commit:
   <can't compute list>

This list might be incomplete or outdated if editing the log
message was not invoked from an up-to-date changes buffer!

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--dev--0.1--patch-3

18 years agoGObjectified Grammar
Thadeu Lima de Souza Cascardo [Sat, 17 Sep 2005 15:09:09 +0000 (15:09 +0000)]
GObjectified Grammar

Grammar is now implemented as a hash table of non-terminals, giving a
list of rules for each of them. It is also a GObject now.

--This line, and those below, will be ignored--
Files to commit:
   <can't compute list>

This list might be incomplete or outdated if editing the log
message was not invoked from an up-to-date changes buffer!

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--dev--0.1--patch-2

18 years agoRecursive parser have start symbol
Thadeu Lima de Souza Cascardo [Sun, 21 Aug 2005 18:36:46 +0000 (18:36 +0000)]
Recursive parser have start symbol

Recursive Descent Parser is initialized with a start non-terminal symbol.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--dev--0.1--patch-1

18 years agoFirst version of libgrammatic with rdp and lr0 parser cascardo@tlscascardo--private,libgrammatic--dev--0.1--base-0
Thadeu Lima de Souza Cascardo [Sun, 21 Aug 2005 15:49:35 +0000 (15:49 +0000)]
First version of libgrammatic with rdp and lr0 parser

Recursive descent parser and LR(0) parser are implemented. Table
generator for LR(0) is yet to be written.

git-archimport-id: cascardo@tlscascardo--private/libgrammatic--dev--0.1--base-0