# YJS grammar - - - ## An overview of the YJS source files include any number of **The import declaration** and one **The contract is defined**. - - - ## The import declaration Like JavaScript (ES6), YJS also supports import statements. At the global level, developers can use the following import statements to import other files. ``` import "filename"; ``` ### content The import statement imports all global symbols (units) contained in the “filename” file into the current file and is globally valid. ### The path **filename** Usually **/** is used as the directory separator to indicate the file path. For example, to import the **x.yjs** file from the same directory to the current file, you can use the **import “x.yjs”** statement. Import **x.yjs** from another directory using the **import “lib/x.yjs”** statement. - - - ## The Contract is defined ### The sample Here is an example contract for JSON processing, with the YJS source file named after the contract name. ``` contract ScoreAdder{ //arg = {"action":"main","arg":"[{\"score\":20},{\"score\":20}]"} export function main(arg){ //JSON is a build-in object. var point = JSON.parse(arg); var s = 0; print(point[0].score); print(point.length); for (var i=0;i Data from contract: ``` The example resource file ”/ HTML /hello.js” is as follows: ```javascript var queryDataFromContract = function(){ //第一个参数为函数名,第二个为参数,第三个参数为回调。 var data = executeCurrentContract("query","abc",function(argg){ $("#resultText")[0].innerHTML = argg.result; }); } ``` Reference example: ### YJS-Python TODO