Code Monkey home page Code Monkey logo

tssg-syntax-parser's Introduction

TSSG Syntax Parser

Parser that generates AST for given TSSG Syntax

Current Version Current Version Current Version

This is the complete rewrite of the TSSG Parser, which is now able to build the AST for TSSG Syntax V0.0.1.

Please note that this project is work-in-progress and will support other advance features soon.

Added Support

Parser supports following expressoins:

  • Schemas Block Expression
    • Schema Expression
    • Extendable Schema Expression
  • Request Bodies Block Expression
    • RequestBody Expression
    • Extendable RequestBody Expression
  • Parameters Block Expression
    • Parameter Expression

Parser support following data types:

  • Literal
  • Identifier
  • Boolean
  • Object
  • Array
  • Function Calls

Note: Complex data types like Array of String, Array of Object is also supported.

Parser also supports miscellaneous features:

  • Whitespaces
  • Multiline Comments

Schema Block Expression

Schemas block can be written as follow:

Schemas {

    BaseUser {
        name: string,
        email: string
    }

    Employee extends BaseUser {
        salary: number,
        department: string
    }

}

Notice how we can extend schemas.

RequestBodies Block Expression

RequestBodies block can be written as Schemas block:

RequestBodies {

    BaseListParams {
        page: number,
        limit: number,
        totalPages: number
    }

    ListUsers extends BaseListParams {
        filters: {
            ids: string[]
        }
    }

}

Parameters Block Expression

Similarly parameters block can be written as:

Parameters {

    GetUser {
        id: string
    }

}

Data Types

Data types can be used as follow:

    User {
        name: string,
        age: integer,
        address: {
            city: string,
            country: string,
            zip: number
        },
        isVerified: boolean,
        profileImages: {
            size: {
                width: number,
                height: number
            }
            url: string
        }[]
    }

Notice address which is an Object with 3 properties. And profileImages which is an Array of Objects with 2 properties.

Syntax Draft Proposal

Read our Proposal Draft.

Hey there! Want to contribute?

  1. Update parser code and run yarn build:prod to generate the parser.
  2. Update transformer code and again run yarn build:prod generate transformer.
  3. Update tests and create PR.

Read our Contribution Guidline.

tssg-syntax-parser's People

Contributors

dependabot[bot] avatar heypran avatar mingwho avatar tauqeernasir avatar yogeshkathayat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

yogeshkathayat

tssg-syntax-parser's Issues

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.