Commit Graph

116 Commits

Author SHA1 Message Date
drh 3bd48ab213 For the Lemon-generated parser, add a new action type SHIFTREDUCE and use it
to further compress the parser tables and improve parser performance.

FossilOrigin-Name: 531c3974b3d586c1989cde905b2fb4681239a570
2015-09-07 18:23:37 +00:00
drh 7e698e9d71 In the "parse.out" output file from Lemon, show addition the complete text
of rules on reduce actions.

FossilOrigin-Name: b6ffb7e471e51ff69668154ad2c8790e466c9d37
2015-09-07 14:22:24 +00:00
drh c75e0166f0 Improved "Parser Statistics" output (the -s option) for the Lemon parser
generator.

FossilOrigin-Name: 809503e4efcdb498d176e8c0794a5ba0882adef2
2015-09-07 02:23:02 +00:00
drh 2547336dad Fix over-length source code lines in Lemon.
FossilOrigin-Name: 1efece95ff8777b89558be59277732ba2a68d5ab
2015-09-04 18:03:45 +00:00
mistachkin 8e18922f12 Fix harmless compiler warnings seen with MSVC 2015.
FossilOrigin-Name: d05becd873a03a366843a34e7f4c732dd8f88c86
2015-04-19 21:43:16 +00:00
drh 1cc0d11a16 Fix harmless compiler warnings in lemon.c
FossilOrigin-Name: bbe7dcda689a25860f2104804f00ba0a720c1372
2015-03-31 15:15:48 +00:00
mistachkin 2318d3387d Work in progress on fixing harmless compiler warnings when using -W4 and MSVC.
FossilOrigin-Name: 856dd245ce037f93d5ae2ddeb4fdf949c1e5c8e9
2015-01-12 18:02:52 +00:00
drh 0325d3962a Enhance the "lemon" executable so that it ignores -f, -W, -O, and -I
command-line options.  This permits most of the same options that are passed
to the compiler to also be harmlessly passed to lemon, and thus
simplifies makefiles.

FossilOrigin-Name: da408d128b4301d9fc7a3a00f219dce7ed48bc60
2015-01-01 19:11:22 +00:00
drh 62a223e5dd Modify the %nonassoc directive in lemon so that it generates a run-time
error rather than a parsing conflict.  This changes is due to a bug report
on the mailing list.  SQLite does not use the %nonassoc directive in its
grammar so this change does not affect SQLite.

FossilOrigin-Name: 1925f3a0a2caa709569df015a8e0d26412f1a9ff
2014-06-09 13:11:40 +00:00
mistachkin 7a429658d7 Fix harmless compiler warning in LEMON.
FossilOrigin-Name: f61a70589ac7e05008a362bd9d5b7bde5d07a758
2014-01-14 10:17:21 +00:00
drh 03e1b1f5ff In LEMON, limit the size of the grammar file to 100MB. This ensures that
the program will never experience integer overflow.  To be doubly sure,
use calloc() instead of malloc() when allocating arrays.

FossilOrigin-Name: 29ba458d849ad8864711cbe59fb10447a947e06a
2014-01-11 12:52:25 +00:00
drh ecaa9d399c Add the "%token_class" directive to the LEMON parser generator. This opens up
the possibility of simplifying the parser.  Also remove all calls to 
sprintf(), strcpy(), and strcat() from LEMON to avoid compiler warnings
on OpenBSD.  (Aside:  It is this change to avoid harmless compiler warnings
that was the cause of the reason spat of bugs.)

FossilOrigin-Name: 8eb48c04bd0a14031488b3160fde67307eb8b35d
2014-01-11 03:27:37 +00:00
drh 61f92cd045 In LEMON, fix a bug in the text formatter introduced by the previous
commit.  Also add the new "%token_class" directive for defining symbolic
names that stand any one of a collection of tokens.

FossilOrigin-Name: da7890ca6b1d8e511377a469047120220e8c3b2d
2014-01-11 03:06:18 +00:00
drh 898799fa00 Do not use sprintf(), strcpy() or strcat() in the implementation of the
lemon parser generator tool, to avoid compiler warnings in OpenBSD.

FossilOrigin-Name: e43c522dde01e134f1adc94f534d2b3eda74afc2
2014-01-10 23:21:00 +00:00
drh 2b51f2153b Fix a harmless compiler warning in lemon.c.
FossilOrigin-Name: 62959c0ce3a2c486ebd82e6511efad0412b944a0
2013-10-11 23:01:02 +00:00
drh 01f75f2d68 In the lemon parser generator, change all hashes to unsigned to avoid
potential problems with signed integer overflow.

FossilOrigin-Name: 8d399a03de63c15908d63ed69140ee15c6275b8d
2013-10-02 20:46:30 +00:00
drh f2f105d40e Remove tab characters from source code files. Replace them with spaces.
FossilOrigin-Name: 7edd10a960d5ff121e470b0549b0aa9fb7760022
2012-08-20 15:53:54 +00:00
drh 8ba0d1cbca In Lemon, when comparing the output to the *.h file to see if it has changed,
make sure that the proposed new output and the preexisting output are the
same size before deciding that they are the same.

FossilOrigin-Name: 0c2fb18d25217ada7e75dcab8b342bbc632875d8
2012-06-16 15:26:31 +00:00
drh d25d692252 Fix a typecast problem in lemon that could cause problems on 64-bit machines.
FossilOrigin-Name: 4a5641cc0aa4c49762f4fe73dab4a6612631c0d2
2012-04-18 09:59:56 +00:00
drh 3cb2f6e60e Cosmetic changes to lemon. No changes to core functionality nor impact on
SQLite.

FossilOrigin-Name: 393fc78a18004c839d889de2a25ec046ad6f13fc
2012-01-09 14:19:05 +00:00
drh 7dd1ac600e Fix a bug in lemon in computation of which non-terminals can generate an
empty string.  This bug and the fix make absolutely no difference for the
grammar used by SQLite, but it can make a difference when lemon is used
in other grammars.

FossilOrigin-Name: ce32775b232da894343f62deefaf19b0ec484636
2012-01-07 15:17:18 +00:00
drh e0a59cf0e1 Fix a total unimportant file descriptor leak in lemon. This is to silence
warning messages.

FossilOrigin-Name: e95cf2c576dda656c0f31eeec3d98e911b9003a1
2011-08-30 00:58:58 +00:00
drh 57489b354d Fix compiler warnings in lemon by removing some of the code added by
Ryan Gordon in [1e8b842039cc0].

FossilOrigin-Name: 76b18b2be072b9ea242df4c9535059f7b43f564b
2011-06-20 18:27:23 +00:00
drh 070d422d31 Add a missing check for out-of-memory in the lemon code generator.
FossilOrigin-Name: efb20b9da6c7cb310a449cc818eaccd3d5bb4ab3
2011-06-02 15:48:51 +00:00
drh df60971765 Cherry-pick the lemon.c updates out of the lemon-update-2010 branch into
the trunk.

FossilOrigin-Name: 1541ae3fbd7b3d471e002c0ad14e7846f7ad9415
2010-11-23 20:55:27 +00:00
drh dd7e9dba97 Improvements to the formatting of parse.out file from Lemon. Add the -r option
to Lemon to disable the state sorting, making debugging easier.

FossilOrigin-Name: a2eaf8294f6d3fb39548987d632e934bb5d71cc9
2010-07-19 01:52:07 +00:00
drh f5c4e0f12a Add the -p option to lemon to cause conflicts resolved by precedence rules
to appear in the parse.out file.

FossilOrigin-Name: fb6a59b0a905ddea071948f9a527483a1b1b219f
2010-07-18 11:35:53 +00:00
icculus 7b429aa6a8 Fixed compiler warning on Visual Studio.
FossilOrigin-Name: 83495128c820e963c70d11c3196f81d8cf01f867
2010-03-03 17:09:01 +00:00
icculus d286fa6691 Whoops, that shouldn't have been in the merge. Removed buggy code.
FossilOrigin-Name: 643728003218c9841425dffb6fe506763859fd37
2010-03-03 17:06:32 +00:00
icculus d49c1aa7a9 Use Strsafe() instead of strdup(). Fixes Visual Studio complaining.
FossilOrigin-Name: 89d8f98ea6d4d8bf871e08a8d8d1f0d2fd11aec1
2010-03-03 17:00:15 +00:00
icculus 05ac70ee0a Merged trunk to lemon-update-2010 branch.
FossilOrigin-Name: 88b466bae47d006c48eff42ab271f05ff56d5ed1
2010-03-03 16:54:58 +00:00
icculus 866bf1e6a2 Repore error if the grammar has multiple %type lines for the same nonterminal.
FossilOrigin-Name: 721f33e7221c5fc907e9e293ac3242843f4fcfb7
2010-02-17 20:31:32 +00:00
icculus d0d97b09c6 Fixed % formatting in some printf-style strings.
FossilOrigin-Name: f96add898f096cfc1e435c625ce74093d790b3c7
2010-02-17 20:22:10 +00:00
icculus 10163b7d82 Corrected error message (cut-and-paste bug).
FossilOrigin-Name: b3839f2aad00844c578d496c40481a39c018e4f6
2010-02-17 20:19:50 +00:00
icculus a3191195af Removed unused variables.
FossilOrigin-Name: ca570a02f5c5215098050de4eb551b2dcd11b1fd
2010-02-17 05:40:34 +00:00
icculus 8e15802812 Removed %expect directive, on drh's advice.
FossilOrigin-Name: b43ac3309e77dc8ea2952bf62da6eaad5aef6653
2010-02-16 16:09:03 +00:00
icculus 15a2cec1ed Patched to compile. Accidentally removed va_list declaration.
FossilOrigin-Name: 673d470c0c14106da05461d355a0c09e5f62851d
2010-02-16 16:07:28 +00:00
icculus 1c11f74a8a Removed the 80-char line formatting for ErrorMsg(), on dhr's suggestion.
FossilOrigin-Name: 132ea4e5d7f69fc307904f5086a72d8532e5aac6
2010-02-15 00:01:04 +00:00
icculus 9e44cf1a03 Make Lemon able to compile as C++ code.
FossilOrigin-Name: 75a1060b29eb4122487152b068e7d1073eb0ccab
2010-02-14 17:14:22 +00:00
icculus d191282111 Added option to not clip error output.
This is useful for IDEs and other tools that benefit from full path
information, so they can jump directly to the error line in the source code.

FossilOrigin-Name: 90602030d18152a934644db119a291aa38fe3fd4
2010-02-14 05:42:46 +00:00
icculus f5ad824071 Delete output files if this is a failed run.
Otherwise, the fail will stop a Makefile from progressing, but if you
immediately run the build again, Make will think the output files are up to
date, since they are newer (albeit incomplete/incorrect).

FossilOrigin-Name: e38c08d9cdeb0476ac1a77cd3f29f547a8205835
2010-02-14 05:34:42 +00:00
icculus 42585cf73a Added %expect directive, to consider a certain number of conflicts "correct."
This has the side effect of changing the process exit code to never overflow.

FossilOrigin-Name: d8bab8cf0bc3fbd4c489c31a65d724dda2944d83
2010-02-14 05:19:56 +00:00
icculus 3e143bdfaf Added -T option, to specify a template filename on the command line.
The default is still "lempar.c", though.

FossilOrigin-Name: e6cbe1e5ee80db282a41951b805b7bd8b13adf28
2010-02-14 00:48:49 +00:00
drh 8dc3e8f3e6 Another attempt at fixing the table generator in lemon. Again, this does
not effect the SQLite grammar.

FossilOrigin-Name: e22c090f35b3a2bac64781d33aa1123ed765dbbf
2010-01-07 03:53:03 +00:00
drh cf3e518506 Fix an issue with lemon generating incorrect grammars. This issue does
not effect SQLite.

FossilOrigin-Name: 077a6bee2dd4668a5b13c37aa7d4c052350ec782
2010-01-06 13:07:30 +00:00
drh f16371d650 Enhancements to lemon to generate more compact action tables and to avoid
making array bounds tests that can never fail on action table calculations.

FossilOrigin-Name: 27d8e684db4651155c4bcb8bb44bf1c692b8c48b
2009-11-03 19:18:31 +00:00
drh e594bc3595 Adjust the lemon implementation so that it always computes the same PDA
regardless of qsort() implementation on the host platform.  In other words,
make all sorts in lemon stable.

FossilOrigin-Name: d66a0f31ebcc56e6f0f462b3db6aab54f7fab816
2009-11-03 13:02:25 +00:00
drh c53eed1703 Change lemon so that it does not generate yytestcase() macros on destructor
cases since destructors are commonly unreachable in a reasonable grammar.
For the reduce-rule switch, gather all no-ops into the "default:" case. (CVS 6757)

FossilOrigin-Name: caebfe82cb1b1215a85ed48fe97360c5422c52e0
2009-06-12 17:46:19 +00:00
drh 7501301e8d The previous check-in ((6755)) put in more yytestcase() macros than are
called for.  This check-in addresses that problem. (CVS 6756)

FossilOrigin-Name: a5b182f93b9e57754c8b9507cf491a7bbf0fd127
2009-06-12 15:47:34 +00:00
drh 8a415d3743 The lemon parser generator now inserts yytestcase() macros on reduce action
and on each destructor, to verify that all have been executed.  yytestcase()
is a no-op by default but can be set to something more useful inside
of %include. (CVS 6755)

FossilOrigin-Name: fe9c9177340a3dc372ffa1b851030d005e0c46db
2009-06-12 13:53:51 +00:00