Hello Richard !

Sorry by split my reply in so many small ones !

When trying to use the generate "parse.sql" I'm getting this:

====

sqlite3 parse.db < parse.sql
Error: near line 10: FOREIGN KEY constraint failed
Error: near line 11: FOREIGN KEY constraint failed
Error: near line 12: FOREIGN KEY constraint failed
Error: near line 13: FOREIGN KEY constraint failed

====

I have "foreign key" ON by default and added "BEGIN; ... COMMIT;" around the generated SQL.

====

BEGIN;
CREATE TABLE symbol(
  id INTEGER PRIMARY KEY,
  name TEXT NOT NULL,
  isTerminal BOOLEAN NOT NULL,
  fallback INTEGER REFERENCES symbol
);
INSERT INTO symbol(id,name,isTerminal,fallback)VALUES(0,'$',TRUE,NULL);

...

INSERT INTO rule(ruleid,lhs)VALUES(384,261);
COMMIT;

====

Cheers !

On 28/11/19 23:54, Richard Hipp wrote:
On 11/28/19, Laurent Dhont <dhontlaur...@hotmail.com> wrote:
is there an API to
get this information in a format that is not an image?
By coincidence, I checked in a change two days ago that might be
helpful.  See https://www.sqlite.org/src/timeline?c=4dbd398d640852d4
for the specific check-in.  If you now build SQLite from canonical
sources, the file "parse.sql" will be left in the build directory.
That file contains SQL text that initializes three SQL tables, the
content of which describe the context-free language grammar that
SQLite uses to parse its SQL input.

There is no documentation of this, but if you have some familiarity
with grammars and parsing and tools like Yacc/Bison or Lemon, then you
should be able to figure it out.

To be clear, I do not expect that the parse.sql file is directly
usable by your application in its current form.  But it is a
machine-readable grammar description, that you can perhaps transform
into a useful format using a script.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to