Code Monkey home page Code Monkey logo

Comments (2)

siscia avatar siscia commented on June 2, 2024

I re-manage a little bit the syntax.

I believe it could be interesting to explore a different syntax and semantic.

I am thinking about commands like:

REDISQL.GET tableName:[index=>value]:[fields]
REDISQL.INSERT tableName:[fields] [values]
REDISQL.SET tableName:[index=>value]:[fields] [value]
REDISQL.DELETE tableName:[index=>value]

This is interesting because it is possible to define a regular grammar for it and use that for parsing:


GET = tableName:tableName sep 
	ind:((indexes sep fields) / (fields sep indexes)) 
    multipleSpace values:values {
    return {
    	tableName: tableName,
        indexes: ind[0]["indexes"],
        fields: ind[2]["fields"],
        values: values
    }
}
SET = tableName sep ((indexes sep fields) / (fields sep indexes)) multipleSpace values
INSERT = tableName sep fields multipleSpace values
DELETE = tableName sep indexes

sep = ':'
arrow = '=>'

tableName = ch:[a-zA-Z0-9]* {return ch.join("")}
indexName = ch:[a-zA-Z0-9]* {return ch.join("")}
indexValue = ch:[a-zA-Z0-9]* {return ch.join("")}
field = ch:[a-zA-Z0-9]* {return [ch.join("")]}
value = ch:[a-zA-Z0-9]* {return [ch.join("")]}
space = ' '
multipleSpace = ' '* {return ' '}

index = name:indexName arrow value:indexValue {return [[name, value]]}
indexes = head:index tail:(sep index)* {
	return {indexes: tail.reduce(function (result, element) {
    	return result.concat(element[1])
    }, head)}
} 

fields = head:field tail:(sep field)* {
	return {fields: tail.reduce(function (result, element) {
    	return result.concat(element[1])
    }, head)}
}

values = head:value tail:(space value)* {
	return tail.reduce(function (result, element) {
    	return result.concat(element[1])
    }, head)
}

from redisql.

siscia avatar siscia commented on June 2, 2024

I decide that projections are not a good idea yet.

I will skip this for now.

from redisql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.