Skip to content

marinthiercelin/airscript-syntax-highlighter

Repository files navigation

airscript-syntax-highlighter README

This is a Virtual Studio Code extension for the AirScript language, used in STARKS proof systems.

Features

  • Basic syntax highlighting for .air files
  • Inline syntax highlighting for .js and .ts files :
    • write airscript templates as
    const template = /*airscript*/`some code with ${variables}`;
    • example :
          import { instantiateScript } from '@guildofweavers/genstark';
      
          const steps = 64;
          const fooSource = /*airscript*/`
              define Foo over prime field (2^32 - 3 * 2^25 + 1) {
      
                  secret input startValue: element[1];
      
                  // define transition function
                  transition 1 register {
                      for each (startValue) {
                          init { yield startValue; }
                          for steps [1..${steps-1}] { yield $r0 + 2; }
                      }
                  }
      
                  // define transition constraints
                  enforce 1 constraint {
                      for all steps { enforce transition($r) = $n; }
                  }
              }
          `;
          
          // define a STARK for this computation
          const fooStark = instantiateScript(Buffer.from(fooSource));
      
          // create a proof that if we start computation at 1, we end up at 127 after 64 steps
          const assertions = [
              { register: 0, step: 0,  value: 1n   },  // value at first step is 1
              { register: 0, step: steps-1, value: 127n }   // value at last step is 127
          ];
      
          const proof = fooStark.prove(assertions, [[1n]]);
      
          // verify that if we start at 1 and run the computation for 64 steps, we get 127
          const result = fooStark.verify(assertions, proof);
          console.log(result); // true

About

Simple syntax highlighter for airscript on vs code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published