Removed previous language grammar. Added a parameter for the bytecode size.

This commit is contained in:
Nicolas Tsiftes 2012-06-04 19:44:08 +02:00
parent c330d8ca84
commit 23cfc77218
2 changed files with 9 additions and 26 deletions

View file

@ -99,36 +99,15 @@ static const char *error_function;
} \ } \
} while(0) } while(0)
/* The parsing of AQL results in this aql_adt_t object. */
/*
* The grammar of this language is defined in Extended Backus-Naur Form,
* where capitalized strings correspond to lexical tokens defined in
* aql.h and interpreted in lexer.c.
*
* operand = LEFT_PAREN, expr, RIGHT_PAREN | INTEGER | FLOAT |
* IDENTIFIER | STRING ;
* operator = ADD | SUB | MUL | DIV ;
* expr = operand, operator, operand ;
*
* comparison-operator = GE | GEQ | LE | LEQ | EQ | NEQ ;
* comparison = expr, comparison-operator, expr ;
* condition = comparison, [(AND | OR), comparison] ;
* relation-list = IDENTIFIER, {COMMA, relation-list} ;
* attribute-list = IDENTIFIER, {COMMA, attribute-list} ;
* select = SELECT, attribute-list, FROM, relation-list, WHERE, condition, END ;
*
* value = INTEGER | FLOAT | STRING ;
* value-list = value, {COMMA, value} ;
* insert = INSERT, LEFT_PAREN, value-list, RIGHT_PAREN, INTO, IDENTIFIER, END ;
*
* sqrl = select | insert ;
*/
static aql_adt_t *adt; static aql_adt_t *adt;
/* Conditional statements are compiled into VM bytecode, which is stored in
an instance of the LogicVM. */
static lvm_instance_t p; static lvm_instance_t p;
static unsigned char vmcode[128]; static unsigned char vmcode[DB_VM_BYTECODE_SIZE];
/* Parsing functions for AQL. */
PARSER_TOKEN(cmp) PARSER_TOKEN(cmp)
{ {
NEXT; NEXT;

View file

@ -87,6 +87,10 @@
#endif /* DB_MAX_ELEMENT_SIZE */ #endif /* DB_MAX_ELEMENT_SIZE */
#ifndef DB_VM_BYTECODE_SIZE
#define DB_VM_BYTECODE_SIZE 128
#endif /* DB_VM_BYTECODE_SIZE */
/* Language options. */ /* Language options. */
#ifndef AQL_MAX_QUERY_LENGTH #ifndef AQL_MAX_QUERY_LENGTH
#define AQL_MAX_QUERY_LENGTH 128 #define AQL_MAX_QUERY_LENGTH 128