]> ocean-lang.org Git - ocean/log
ocean
10 years agoparsergen: allow "$void" to remove current type. draftparser
NeilBrown [Sun, 21 Jul 2013 09:27:27 +0000 (19:27 +1000)]
parsergen: allow "$void" to remove current type.

This allows return to the initial state where nonterminals
have no type.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoparsergen: improve tracing.
NeilBrown [Sun, 21 Jul 2013 09:18:09 +0000 (19:18 +1000)]
parsergen: improve tracing.

Change the tracing to print the full stack after every step.
This can be cross-referenced with the report that parsergen
can generate to get a full picture of how the parse is progressing.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoparsergen: make sure we continue making states until all done.
NeilBrown [Sun, 21 Jul 2013 08:20:00 +0000 (18:20 +1000)]
parsergen: make sure we continue making states until all done.

Whenever we add a state, we need to check again, as it might have been
added early in the list.
There is probably a much more efficient way to do this....

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoparsergen: change sort order for items.
NeilBrown [Sun, 21 Jul 2013 08:10:45 +0000 (18:10 +1000)]
parsergen: change sort order for items.

I want items with larger indexes to always preceed smaller
indexes.  This makes the report easier to follow.
So negate the index number (and add an offset) when sorting.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoparsergen: change symset function to use 'unsigned short'.
NeilBrown [Sun, 21 Jul 2013 08:04:24 +0000 (18:04 +1000)]
parsergen: change symset function to use 'unsigned short'.

To make full use of all 16 bits of a sym, we should make sure
we consistent use "unsigned".

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoparsergen: fix bug testing return value for shift()
NeilBrown [Sun, 21 Jul 2013 08:00:13 +0000 (18:00 +1000)]
parsergen: fix bug  testing return value for shift()

shift() returns 0 on failure, not negative.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoparsergen - adjust for recent scanner fix.
NeilBrown [Sun, 21 Jul 2013 07:58:34 +0000 (17:58 +1000)]
parsergen - adjust for recent scanner fix.

scanner was recently fixed to correctly skip over C code with
a string immediately after a '(', so we can remove the extra
spaces we inserted before.

For this to work, we need to stop ignoring TK_String

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoscanner: don't allow an unknown mark to run into a string or comment
NeilBrown [Sun, 21 Jul 2013 07:53:51 +0000 (17:53 +1000)]
scanner: don't allow an unknown mark to run into a string or comment

This means that e.g.
   printf("hello")
where no marks are declared will not treat
    ("
as an known mark, but instead find
    (
and then a string.

This is important for skipping over C code in 'parsergen'.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoscanner: initialise token state properly.
NeilBrown [Sun, 21 Jul 2013 07:52:39 +0000 (17:52 +1000)]
scanner: initialise token state properly.

We need to call do_strip() at the start to ensure the correct
col and indent is used for the first token.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoscanner: fix do_strip bug.
NeilBrown [Sun, 21 Jul 2013 07:51:37 +0000 (17:51 +1000)]
scanner: fix do_strip bug.

do_strip wasn't striping tabs properly

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoMakefile: if bootstrap was required, suggest "make" be run again
NeilBrown [Fri, 12 Jul 2013 21:25:00 +0000 (07:25 +1000)]
Makefile: if bootstrap was required, suggest "make" be run again

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoUpdate .gitignore with new build targets
NeilBrown [Fri, 12 Jul 2013 21:23:03 +0000 (07:23 +1000)]
Update .gitignore with new build targets

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoNew file: parsergen
NeilBrown [Fri, 12 Jul 2013 21:21:37 +0000 (07:21 +1000)]
New file: parsergen

This reads and analyses a grammar and generates a parser.

It include a simple calculator

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoscanner: must call close_token before returning the token.
NeilBrown [Fri, 12 Jul 2013 21:18:06 +0000 (07:18 +1000)]
scanner: must call close_token before returning the token.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoscanner/numbers: fix typo that broken positive exponents.
NeilBrown [Fri, 12 Jul 2013 21:16:07 +0000 (07:16 +1000)]
scanner/numbers: fix typo that broken positive exponents.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoscanner: make the array of known words "const"
NeilBrown [Fri, 12 Jul 2013 21:15:32 +0000 (07:15 +1000)]
scanner: make the array of known words "const"

After all, it shouldn't change.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agomdcode: rename code_print to code_node_print and export it.
NeilBrown [Fri, 12 Jul 2013 21:13:55 +0000 (07:13 +1000)]
mdcode: rename code_print to code_node_print and export it.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoFix typo in mdcode.mdc
NeilBrown [Fri, 12 Jul 2013 21:12:21 +0000 (07:12 +1000)]
Fix typo in mdcode.mdc

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoscanner.mdc: lexical scanner for Ocean.
NeilBrown [Sat, 22 Jun 2013 09:18:55 +0000 (19:18 +1000)]
scanner.mdc: lexical scanner for Ocean.

This scanner does lexical analysis and produces tokens.
It also handles numbers and escapes in strings.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoMakefile: auto-support .mdc files.
NeilBrown [Sat, 22 Jun 2013 09:17:49 +0000 (19:17 +1000)]
Makefile: auto-support .mdc files.

Any *.mdc cause "md2c" to be run to create a "*.mk" file which is
included and used.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoRecord in a code_node whether it was indented or not.
NeilBrown [Sat, 22 Jun 2013 07:39:23 +0000 (17:39 +1000)]
Record in a code_node whether it was indented or not.

This is needed to correctly adjust for this indent when processing the
code.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agomdcode, md2c - extract C code from a literate markdown program
NeilBrown [Wed, 5 Jun 2013 20:20:35 +0000 (06:20 +1000)]
mdcode, md2c - extract C code from a literate markdown program

All C programs here will be written in literate style using markdown.
md2c strips out the C code so that it can be compiled.

Signed-off-by: NeilBrown <neilb@suse.de>