I was also looking for some postfix operator syntax in a DSL, and I noticed that
    
    
    `*`
    
    
    Run

(how to write that in as inline RST?) can actually be used. Looks like a 
postfix operator, but semantically it is just an `AccQuoted` argument to the 
preceding `Command` node. In your case:
    
    
    activations:
      act sigmoid`*`:
        fn: 1 / (1 + exp(-x))
        deriv: fx * (1 - fx)
      act tanh`*`:
        fn: tanh(x)
        deriv: (let t = tanh(fx); 1 - t * t)
    
    
    Run

The relevant part of the AST is:
    
    
    Command
      Ident "act"
      Command
        Ident "sigmoid"
        AccQuoted
          Ident "*"
    
    
    Run

Slightly non-standard, but works well in my purpose and looks even better in an 
editor with special syntax highlighting for acc-quoted ops.

Reply via email to