Commit Graph

164 Commits

Author SHA1 Message Date
drh 59c5679691 Fix incorrect SQL generated by the Lemon change of the previous check-in.
FossilOrigin-Name: fccfb8a9ed3c1df9f23762bb8df6fdf36a21118899e3fae41f451169a5f2c08e
2019-12-19 13:17:07 +00:00
drh 3e5f7fef33 Modify the parse.sql output file from Lemon so that the RULE table contains
a column with the complete text of the rule.

FossilOrigin-Name: 329cbb372d4d77f774f01a87d104c40ef42d713afbe76195b65f5ca205c5ea7b
2019-12-19 12:29:31 +00:00
drh 3ecc05bc3f Fix goofy string formatting in lemon.c that dates from the K&R-C days.
FossilOrigin-Name: 48ba5e5a2227257cebafacbb09e9dd91d9b89ab2d52a8b4e4113c1d017d95f41
2019-12-12 00:20:40 +00:00
drh ce678c297b Improved tracing output from the LEMON-generated parser.
FossilOrigin-Name: 4d6d2fc046d586a1e5989bbb2757f13d0371fbfad0acf45a0e2fd77dffd8d8f9
2019-12-11 18:53:51 +00:00
drh e94006eb42 Enhance LEMON to provide the ability to mark a rules as one that will never
reduce due to intervention of actions.  Use this new capability to designate
the EXPLAIN rule as NEVER-REDUCES.

FossilOrigin-Name: 136cdefb2f7b582ff1771ac7f9e733dc24c357605526cbfb1834937697c8a922
2019-12-10 20:41:48 +00:00
drh 61cb4ed7f1 Add comments in the parse.sql file to help demonstrate how rules are
encoded.

FossilOrigin-Name: 2c4f714892327a1a9a303267b1f9685e310cca5dcea9c61287d95e26291b0506
2019-11-29 13:01:57 +00:00
drh 1417c2f77f Fix the parse.sql output file so that it is readable into a database where
foreign keys are enforced.

FossilOrigin-Name: 3a82c554c3bde4640df6865686f8f70e2c1e07c581fed4772b6b0a8ec1b10bb6
2019-11-29 12:51:00 +00:00
drh fe03dac236 Add the new -S option to the lemon parser generator to cause it to output
SQL that describes the input grammar.

FossilOrigin-Name: 4dbd398d640852d4a696d68c72ee039968023d402a8053b5e6b4ef1d75e982a8
2019-11-26 02:22:39 +00:00
mistachkin acf6e08d20 Fix typo for one instance of line number handling in the Lemon tool.
FossilOrigin-Name: 980be1730dc1239c63a107923bf2e32b4ec7d4bc31b9190e711cc35f18cc2bb4
2019-09-11 15:25:26 +00:00
drh 010bdb4c79 Further improvements to parser speed by enlarging lookup tables to eliminate
the need to do range checking on the index prior to lookup.

FossilOrigin-Name: 47d3e091ae49eb7947af5abef9b5b96b16b86d349e51fe0677795649be6db473
2019-08-28 11:31:11 +00:00
drh 2e51716b15 Increase the size of the yy_lookahead table so that it is never necessary to
down bounds checking on the index.

FossilOrigin-Name: bafd872398e58766e996963372c7acc03a1e20a6d39a3867ca45d3ea0ed2ac1d
2019-08-28 02:09:47 +00:00
mistachkin 17df761a84 Fix harmless compiler warning in lemon.
FossilOrigin-Name: 2da0eea02d128c37f2fbe764227ac526d3e993284516544adc0a216a035c5676
2019-06-03 15:09:25 +00:00
mistachkin d9bc6e8973 Fix some harmless compiler warnings.
FossilOrigin-Name: ca068d82387fc3cda9d2050cedb4f9c61b6d9dc54f89015b4b2ee492243ed5c9
2019-05-10 16:16:19 +00:00
drh f135cb7d7f Fix an error message in the Lemon parser generator.
FossilOrigin-Name: b6d7d42b7426622a26b67809cd1f21285fea120aa1897377b9946840463b41f1
2019-04-30 14:26:31 +00:00
drh e2dcc42e1f Fix a harmless memory leak in the Lemon parser generator utility program.
FossilOrigin-Name: 1caff0fb0b2051e205e7a8cfd5dadf92680c52a88a441ded95b1ea6542db5f83
2019-01-15 14:44:23 +00:00
drh cfc45b1021 Reduce the size of the parser tables generated by Lemon by splitting the
yyRuleInfo structure into separate yyRuleInfoLhs and yyRuleInfoNRhs arrays.

FossilOrigin-Name: 70fe8ec2ae3099b8773834c7ac2e56768addbecd57956ac523e71a7dc264049c
2018-12-03 23:57:27 +00:00
mistachkin c93c614543 Add a missing call to free() in Lemon.
FossilOrigin-Name: 8b4cf33aafe09d9009119dcbd464b54be9605af5701002ee458819efa6e2e1f9
2018-09-08 16:55:18 +00:00
drh 539e741e50 Enhance LEMON to track which symbols actually carry semantic content.
Output the list of symbols that do not carry content at the end of the
report, but do not (yet) do anything else with the information.

FossilOrigin-Name: dcf2bafc159179859b91ffea3a4ebd70b5ca6de9e1d515eaf9afde8cfff26c6c
2018-04-21 20:24:19 +00:00
drh fb32c44e41 Add the %extra_context directive to lemon, as an alternative to %extra_argument.
Use this to improve the performance of the parser.

FossilOrigin-Name: be47a6f5262a43f477700579512fe7112a0872faedcbbe5c3383d13a08af6440
2018-04-21 13:51:42 +00:00
drh 9f88e6d861 Add the -dDIRECTORY command-line option to LEMON.
FossilOrigin-Name: 9cd20475ff3b2ca1a58e441194c921780d25bdb9b9c744a6b4541b888194efb8
2018-04-20 20:47:49 +00:00
drh ed0c15b52e Lemon enhancements: (1) Do not allocate space for the 'error' non-terminal
if it is not used. (2) Fix an off-by-one problem so that 'unsigned char' can
be used for symbol numbers if the number of symbols is 256.

FossilOrigin-Name: 3b7801acff91905d0e78e06121ebcf2664f6de5f605699dc8726ec9bcb558eb8
2018-04-16 14:31:34 +00:00
drh 12f6839380 Enhance LEMON to show precendence of symbols and all rules in the report
that is generated in parallel to the parser.

FossilOrigin-Name: 602fbd8149b53d8f0e9a223cc1aec912e7df03fca35071e8d707776ce225371c
2018-04-06 19:12:55 +00:00
drh 4396c61959 In LEMON, fix an off-by-one error that can make the lookahead table one
byte too smal.

FossilOrigin-Name: 93792bc58a2eccc7e07b14307388350bb376db32c5055b79a44e4fa8ff91d58e
2017-12-27 15:21:16 +00:00
drh 0d9de99c5c Add support for measuring and reporting coverage of the parser state machine
using the SQLITE_TESTCTRL_PARSER_COVERAGE test-control.

FossilOrigin-Name: 1253a872dbf48656d4efd588ab61223a5ac550d9b2b932249d6ba585276ba573
2017-12-26 18:04:23 +00:00
drh 3a9d6c7156 Enhance LEMON so that it generates the action table in such a way that no
range check is needed on the lookahead table to verify that the next input
token is valid.  This makes the lookahead table slightly larger (about 120
bytes) but helps the parser to run faster.

FossilOrigin-Name: 7eb0198d0102e97e4b7ad9e359d95985e55e09c510ea4b360265ac8feb9ed814
2017-12-25 04:15:38 +00:00
drh 5c8241b875 In the LEMON-generated parser, rearrange the meanings of integer action codes
so that reduce actions occur last.  This means that the most common case
(reduce actions) can be recognized with a single comparison operation, thus
speeding up the main parser loop, slightly.

FossilOrigin-Name: 7bfe7a360261ac7227840db49487c2f0fe338a2f1b868fcaada1e04a8d2b8f7a
2017-12-24 23:38:10 +00:00
drh 59c435a015 Add the "%token" control to the lemon parser. Not currently used by SQLite.
FossilOrigin-Name: a6e4c5ae8f29bc2e7f2088426341254e9281d19db9dc9a14abc376d56dad4c4b
2017-08-02 03:21:11 +00:00
drh 6be95366c7 In the lemon-generated parser, store the number of symbols on the RHS of each
rule as a negative number and add it to the stack pointer, rather than storing
the value as a positive and subtracting it.  This makes the parser faster.

FossilOrigin-Name: b362f0d8ed34839bf3b29d10ed0853ab94245fba135ccd28e619caa6ee6992d5
2017-06-28 13:47:56 +00:00
drh bd8fcc130a In the lemon-generated parser, automatically promote SHIFTREDUCE actions on
nonterminal systems to pure REDUCE actions, for a performance enhancement.

FossilOrigin-Name: c46d94a8cde816ca383e771721ebd4900de77950cba700e35a26f70fd5b794a4
2017-06-28 11:56:18 +00:00
drh 69bfa55279 Fix a subtle bug in Lemon discovered and reported on the mailing list
by Kelvin Sherlock, who also suggested the correct fix.

FossilOrigin-Name: 304689f8acb53d68e1afed6e6c4332e78132e3d57071b8f94df0d13515b3b3d8
2017-04-26 04:32:17 +00:00
drh 06f60d8e87 Remove end-of-line whitespace from lemon.c.
FossilOrigin-Name: d78355c85f49e139f1ac1a660563865350f0e442652b7bc50b684398f81cc602
2017-04-14 19:46:12 +00:00
drh 14d8855b8f Fix some left-over K&R-C constructs in lemon.c. No changes to the core.
FossilOrigin-Name: a53799059d4ece246610b6c877ab7088ded3548cbca7149a03deea8ac0e27e68
2017-04-14 19:44:15 +00:00
drh 96ada59cbb Fix harmless compiler warnings in the command-line shell and in Lemon.
FossilOrigin-Name: afcdc4a60e357d171156e0de705bf7ad1b37daab
2016-12-29 19:48:46 +00:00
drh 0f832ddc06 Fix a bug in destructor processing of Lemon. That has no impact on the
SQLite grammar.  The bug was introduced by prior work to optimize the
Lemon-generated parser used by SQLite.

FossilOrigin-Name: f9035b8e2ea331801402bcb62b203ab092949770
2016-08-16 16:46:40 +00:00
drh 701b68879c Improved comments on the lempar.c parser template. Adjust the
YY_SHIFT_USE_DFLT constant in the Lemon-generated parser tables so as
to guarantee that it is always out of range of the yy_lookahead[] table.

FossilOrigin-Name: 83622f3f50030e4d6abafb99d99742928aaf157c
2016-08-10 13:30:43 +00:00
drh 756b41ebd4 Enhance Lemon and the parser template so that it can once again build parsers
that have no unreachable branches.

FossilOrigin-Name: 41fd46e2962ba9a1e1f6867567499d1f6f5b8372
2016-05-24 18:55:08 +00:00
drh c173ad8011 Lemon enhancement: avoid unnecessary reduce actions that convert one
non-terminal into another but have no side effects.

FossilOrigin-Name: a86e782ad1aa6f5a8b2c54f9dcf0fa61960843f3
2016-05-23 16:15:02 +00:00
drh 711c9810dc Fix comment typos and improve clarity of presention in Lemon. The output
should be identical.

FossilOrigin-Name: b91a5b8297756289d45c8fce0d3399c253517eb0
2016-05-23 14:24:31 +00:00
drh 2e55b04da4 More bug fixes to Lemon identified by Kelvin Sherlock. None of these
have any impact on SQLite.

FossilOrigin-Name: 762bdc55f8878ee2ef65af2165a8e7fdbddf0160
2016-04-30 17:19:30 +00:00
drh afb8cd977d Lemon bug fix: Do not merge action routines unless their destructors are
also identical.  Problem and suggested fix reported on the mailing list
by Kelvin Sherlock.

FossilOrigin-Name: 4792d6dbba6857f74d27332dcc1468e39c767c71
2016-04-29 11:28:35 +00:00
drh 4ef07708df Enhance Lemon so that it reorders the reduce rules such that rules without
actions occur at the end and so that the first rule is number 0.  This
reduces the size of the jump table on the reduce switch, and helps the parser
to run faster.

FossilOrigin-Name: d5712f21ec758ff096a7b1bb8ed4fc5ec400ca5d
2016-03-16 19:45:54 +00:00
drh 43303de97e More agressive use of /*A-overwrites-X*/ in the parser. Fix an off-by-one
error in parser stack overflow detection.

FossilOrigin-Name: 417e777701bbf4bd67626d4ca3bc2c5d847f6cd0
2016-02-17 12:34:03 +00:00
drh cf82f0d3d2 Enhance Lemon so that if reduce code contains a comment of the form
"/*A-overwrites-X*/" then a LHS label A is allowed to overwrite the
RHS label X.

FossilOrigin-Name: 5cfe9545d478a2c500083613dd20e14b2ffce645
2016-02-17 04:33:10 +00:00
drh dabd04c656 Further improvements to the Lemon-generated code for yy_reduce().
FossilOrigin-Name: ef95a7d6490e33a9af4bc7b4b622de7328742ca7
2016-02-17 01:46:19 +00:00
drh 4dd0d3f819 In Lemon, add the ability for the left-most RHS label to be the same as the
LHS label, causing the LHS values to be written directly into the stack.

FossilOrigin-Name: 4bb94c7c4c3cb3ccad72c2451d88684130dde845
2016-02-17 01:18:33 +00:00
drh c56fac7483 Fix uses of ctype functions (ex: isspace()) on signed characters in test
programs and in some obscure extensions.  No changes to the core.

FossilOrigin-Name: 34eb6911afee09e779318b79baf953f616200128
2015-10-29 13:48:15 +00:00
drh 0c6dfaa34a Remove an unused local variable from Lemon.
FossilOrigin-Name: fe9ffe5eed7d376f3f08c78c1ce5514c886f3479
2015-09-08 21:16:46 +00:00
drh 337cd0def4 Minor tweaks to Lemon.
FossilOrigin-Name: 986677224a8da5e79fbbd90673f1b595da89c5d6
2015-09-07 23:40:42 +00:00
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