LANGUAGE SPECIFICATION

RAIQL 0.2

The normative surface implemented by the current RAIQL compiler. This specification defines supported top-level statements and their structural meaning.

Lexical model

Keywords are case-insensitive. Application names are double-quoted strings. Top-level statements terminate with a semicolon. Comments beginning with -- are removed to end of line; lines beginning with # are also treated as comments.

Grammar overview

EBNF-style overview
program          := statement*
statement        := application | appType | stack | entity | relation
                  | crud | api | authentication | roles | permission
                  | generateTests | build | deploy

application      := CREATE APPLICATION STRING [TYPE APP_TYPE] ;
appType          := TYPE (WEB | MOBILE | API) ;
stack            := USE STACK stackEntry (, stackEntry)* ;
entity           := CREATE ENTITY IDENTIFIER ( field (, field)* ) ;
relation         := RELATE reference TO reference ;
crud             := CREATE CRUD IDENTIFIER ;
api              := CREATE API IDENTIFIER ;
authentication   := ADD AUTHENTICATION IDENTIFIER (, IDENTIFIER)* ;
roles            := ADD ROLE IDENTIFIER (, IDENTIFIER)* ;
permission       := ALLOW IDENTIFIER permissionItem (, permissionItem)* ;
generateTests    := GENERATE TESTS ;
build            := BUILD ;
deploy           := DEPLOY [IDENTIFIER] ;

Application declarations

A program must contain exactly enough information to establish an application name. If no application type is supplied, compilation produces a warning rather than an error.

CREATE APPLICATION "Ledger" TYPE API;

Cross-reference rules

CREATE CRUD, CREATE API and both sides of RELATE must reference declared entities. ALLOW must reference a role previously declared with ADD ROLE. Violations are compiler errors.

Compilation result

A successful compilation emits a JSON-serializable RAIQL intermediate representation containing application metadata, stack selections, entities, relationships, APIs, CRUD intent, authentication mechanisms, roles, permissions and delivery actions.

Versioning

This specification describes language version 0.2. New syntax should preserve backwards compatibility within the same minor line where practical; incompatible grammar changes require a new language version.