rintolang / rinto

In-development open source programming language based on C/C++
https://rintolang.github.io
GNU General Public License v3.0
3 stars 2 forks source link

JSON Implementation #8

Open rohan221102 opened 2 years ago

rohan221102 commented 2 years ago

Implement JSON objects in Rinto such that it can read a .json file and initialise it as a Rinto object.

zeim839 commented 2 years ago

We're probably best off saving this until later. This sounds like it could be part of a Rinto standard library, so It'd be best to write it using the rinto language itself.

rohan221102 commented 2 years ago

Example of JSON:

{
    "databases": [
        {
            "name": "MySQL",
            "type": "RDBMS"
        },
        {
            "name": "MongoDB",
            "type": "NoSQL"
        },
        {
            "name": "Neo4j",
            "type": "Graph DB"
        }
    ]
}

Rinto object example:

void main(){
    jsonObj example = jsonObj("example.json")

    print(example.databases[0].name)
    // Expected output: MySQL

    print(example.databases[0])

    /*
    Expected output:
        name: MySQL,
            type: RDBMS
    */

    print(example.databases)

    /*
    Expected output:
        [0]
        name: MySQL,
        type: RDBMS
        [1]
        name: MongoDB,
        type: NoSQL
        [2]
        name: Neo4j,
        type: Graph DB
    */

    print("MySQL" == example.databases[0].name)
    // Expected output: true

}
zeim839 commented 2 years ago

Do you plan to write this in C++, or do you propose that we add this as a feature of the rinto language?

rohan221102 commented 2 years ago

I think that writing it natively would be best practise.

On Sat 30 Jul 2022 at 15:43, zeim839 @.***> wrote:

Do you plan to write this in C++, or do you propose that we add this as a feature of the rinto language?

— Reply to this email directly, view it on GitHub https://github.com/rohan221102/rinto/issues/8#issuecomment-1200142905, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKQCXXF6JBKRVT3MUF7HJRLVWUIM3ANCNFSM55DBX5IQ . You are receiving this because you were assigned.Message ID: @.***>

zeim839 commented 2 years ago

Sounds good. Should we create a github project board to keep track of todo's/features?

rohan221102 commented 2 years ago

Sounds good to me

On Sat 30 Jul 2022 at 16:19, zeim839 @.***> wrote:

Sounds good. Should we create a github project board to keep track of todo's/features?

— Reply to this email directly, view it on GitHub https://github.com/rohan221102/rinto/issues/8#issuecomment-1200147881, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKQCXXEURXXELMKCGQCATPDVWUMVDANCNFSM55DBX5IQ . You are receiving this because you were assigned.Message ID: @.***>