How to understand syntax engine in Isabelle - verification

I'm attempting to understand Isabelle's inner syntax engine, but I'm having problems reading Chapter 8 of the Isabelle standard reference manual. (Isar-ref or The Isabelle/Isar Reference Manual by Makarius Wenzel).
As seen in the diagram below, there is a general inner syntax engine described in the manual. I'm trying to figure out how this process works and where functions like syntax translation print_translation come into play in this diagram.
Furthermore, is there a simple example for learning this entire process?

Related

A grammar for Access SQL

Does a grammar (like in EBNF or similar format) exist for MS Access SQL syntax? Like how TSQL syntax is documented with EBNF: https://learn.microsoft.com/en-us/sql/t-sql/queries/select-transact-sql?view=sql-server-2017.
I have only been able to find find tutorials with examples, but not a full grammar.
You can find the full Access SQL reference here on MS Docs.
Note that some statements are exclusive to the SQL server compatible syntax (anything with the DECIMAL type and CHECK constraints), and this isn't properly described in the reference.
It isn't as extensive and well-written as the T-SQL stuff, but it's closest to what you're asking.

RDBMS Relational Algebra Example

I am working on implementing a Relational Database Management System for a school project. The system generates pseudo-SQL commands based on what the user enters into an interactive system. These commands are passed through a parser, which translates the line into actual function calls that the engine can execute.
I feel like I understand fairly well the operations that the database needs to perform in an SQL sense, but I'm unsure of how to translate those tasks to a procedural language that can actually carry out those operations.
I'm trying to find one or more examples of a relational algebra system implemented in an object oriented language like C++ or Java, so I can get an idea of what might work for my design. If anyone has an example they can share with me, that would be greatly appreciated. It doesn't need to be super complicated (in fact I would prefer the opposite), I am just trying to get an idea of how I might translate operations like selection or projection into an actual programming language.
Take a look at SIRA_PRISE - a "Straightforward Implementation of a Relational Algebra - Prototype of a Relational Information Storage Engine".

SQL: source code / under the hood

I'm trying to gain a deeper understanding of SQL, and I was just wondering - what was SQL originally written in? I did some research, and according to this stackoverflow page, it seems that SQL was originally written in C. If so, is there any way I could access the original source code to see how SQL really works under the hood - its algorithms, data structures etc? If SQL was indeed written in C, its inner workings must be imperative since C is an imperative language, and since I am more versed in C++ than in SQL, it would be really rewarding to explore SQL in terms of an imperative paradigm. Thanks in advance for any insight you may have!
SQL is a language definition, which itself is not written in anything but plain text.
Also, you can implement a compiler/engine for SQL or Java or whatever high level language in C++, C, Assembly, or even directly in machine code if you like, so the language in which it is implemented doesn't tell you anything about its possibilities.
Which SQL? There are a lot of different competing SQL database flavors out there: Sql Server, Oracle, MySql, PostgreSQL, Access, SqlLite, Sybase... and that's just the tip of the iceberg. Fortunately, several of those are open source... you can go look at the code for yourself.
You can also read the Sql Language Specifications.

Using Oracle SQL syntax for custom developed database server

Is it possible to implement own database server taking Oracle PL/SQL syntax as the bases or i would like to ask why different database solutions have different syntax eg: SQL server, MySql, Sqlite etc. can't they have some specific standard of syntax for basic operations including PL/SQL(excluding SQLite) why everyone is having a different syntax, sorry for diversion of question into patent issues but i could not find a better place to ask this question.
Of course you can, but you have to parse the PL/SQL yourself into something other platforms understand. (You can use ANTLR for example as parser tool. There is even a full featured grammar for PL/SQL) This is possible for small solutions with a small instruction set, but for large, full support of PL/SQL you need to be Oracle-sized.
To answer the why: two reasons:
There is no standard, so everyone picks his own;
You don't want customers to leave, so your own 'best' framework that is incompatible with others, that is your USP, and it prevents users from just porting their code to the other platform. They are stuck on yours.

Which language has good SQL parsing library?

I'm looking for good SQL parser. One that will work with subselects, non-select queries, CTE, window functions and other legal SQL elements.
Result would be some kind of abstract syntax tree, that I could later on work on.
Language is mostly irrelevant, as I am willing to learn new language just to use the library, if it exists.
I know that it is technically possible to extract parser from some open source database, but it's far from easy (at least for the parser of PostgreSQL which is what I need).
There's a non-validating SQL parser in Python: python-sqlparse. The tokens are exposed as objects. I doubt if they support "other legal SQL statements", window functions, and the like though as those are controlled by vendor specific grammars and no vendor is technically fully compliant with SQL standards.
Um (knowing that you're willing to learn a new language), why would you need to work on the syntax tree? If you need some magic in dealing with the database, probably you don't need to reinvent the wheel: Python got a fantastic database toolkit - SQL ALchemy.
You can google "sql parser". This is the one that listed: General SQL Parser Here are some highlighted features listed on official website:
Offline SQL syntax check
Highly customizable SQL formatter
In-depth analysis of SQL script
Fully access to SQL query parse tree
Custom SQL engine for various databases
Major programming language support
It's a commercial SQL library.
Our DMS Software Reengineering Toolkit has PL/SQL and ANSI SQL 2011 full parsers (to ASTs) and prettyprinters (ASTs back to valid text). Neither of these are PostGres SQL, but DMS has a dialect mechanism that enables one to relatively easily build a dialect from a base grammar, by revising just some of the grammar rules and retaining the rest. Doing this from the SQL 2011 grammar seems like a practical way to tackle the problem.
DMS also offers facilities to access/traverse/modify the ASTs, both procedurally and in terms of surface-syntax patterns and transformations. Think of this as "life beyond parsing".