Skip to content

Instantly share code, notes, and snippets.

@iantanwx
Created July 25, 2018 16:12
Show Gist options
  • Save iantanwx/8836d4303313ac23f9f4d637c534b666 to your computer and use it in GitHub Desktop.
Save iantanwx/8836d4303313ac23f9f4d637c534b666 to your computer and use it in GitHub Desktop.
PoC: Peg.js grammar for parsing JSON encoded Scilla types
BaseType = base:(Map/Uint/String) _* "(" vtypes: (type:VType _* {return type})* ")" { return { base: base, vtypes: vtypes }}
VType = Uint/String
Map = "Map"
Uint = "Uint"
String = "String"
_ = [ \t\n]
@iantanwx
Copy link
Author

Input:

Map (String Uint)

Output:

{    "base": "Map",    "vtypes": [       "String",       "Uint"    ] }

@iantanwx
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment