iAutomator

Version

v0.1.0

Language Overview

This language is used to define automation scripts that can be used to perform automated operations in a web browser, such as opening a webpage, clicking, inputting text, and more, in order to improve browsing experience and efficiency.

Language Rules

The language consists of the following parts:

  1. Comments, which support single-line and inline comments starting with #.
  2. automation definition blocks:
    automation for "{url pattern}" on "{stage: immediate | load | delay}"
    # Here are the specific statements
    end
    
  3. statement Statements Statements are written inside an automation block and can be divided into the following three categories:
    • Assignment statements
      • The format is: set var = {value | variable | listen expression | get expression}

Example

## Language Grammar

 Script ::= *empty*
       ::= Automations

Automations ::= Automation
            ::= Automations
Automation::= automation AutomationHead AutomationBody end

AutomationHead ::= for URLRegString on Stage
Stage ::= '"immediate"'
      ::= '"load"'
      ::= '"delay"'
      
URLRegString ::= string
      
AutomationBody ::= Statements
Statements ::= Statement
           ::= Statements
           
Statement ::= AssignStatement
          ::= NativeStatement
          ::= ApplyStatement
          
AssignStatement ::= AssignExp = ValuableExp
                
ValuableExp ::= ValueExp
            ::= Identifier
            ::= ListenExp
            ::= GetValueExp
            
ValueExp ::= number
         ::= string
         ::= bool
            
ListenExp ::= listen EventNameExp on EventScopeExp
EventNameExp ::= string
EventScopeExp ::= '"global"'
              ::= CssSelectorExp
              
NativeStatement ::= OpenStatement
                ::= ActiveStatement
                ::= WaitStatement
                ::= CloseStatement
                ::= EmitStatement
                ::= ListenStatement
                
OpenStatement ::= OpenExp
OpenExp ::= open URLString as URLRegString
URLString ::= string

ActiveStatement ::= ActiveExp
ActiveExp ::= active

WaitStatement ::= WaitExp
WaitExp ::= wait number
                 
CloseStatement ::= close

EmitStatement ::= emit EventNameExp with ArgPairs

ListenStatement ::= ListenExp

ApplyStatement ::= apply ActionNameExp with ArgPairs on CssSelectorExp 
ActionNameExp ::= string

ArgPairs ::= (ArgsExp)
         
ArgsExp ::= empty
        ::= ArgExp
        ::= ArgExp, ArgsExp
        
ArgExp ::= Identifier
       ::= Identifier = ValueExp
       ::= Identifier = Identifier

CssSelectorExp ::= string