ExampleDFL

ThoughtStorms Wiki

Methods = (? | MethodDef ?)*

MethodDef = ClassName ? <'::'> MethodSelector ArgList (? <'='> ? MethodBody)? ? <'.'>

MethodSelector =QuerySelector | UpdateSelector QuerySelector = #'\w+' UpdateSelector = #'\w+!'

MethodBody = Expr = SingleItemExpression | MessageExpression | BinaryExpression = ObjName | Number | StringLiteral | DoBlock ObjName = #'[A-Za-z_]\w*' = IntNumber | FloatNumber IntNumber = #'[1-9][0-9]*' FloatNumber = #'[0-9]+.[0-9]+' StringLiteral = #'\"["]*\"'

MessageExpression = ObjName <'.'> MethodSelector ArgList BinaryExpression = <'('> Expr ? Op ? Expr <')'>

Op = ArithmeticOp | BooleanOp | ComparisonOp = '+' | '-' | '*' | '/' | '%' | '**' = '&' | '|' = '==' | '!=' | '<' | '>' | '<=' | '>=' ArgList = <'()'> | <'('> ArgName (',' ? ArgName)* <')'> ArgName = #'[A-Za-z_]\w*' = #'\n' = #'\s+' ClassName = #'[A-Z]\w*'

DoBlock = <'[<'> (DoLine )* <'>]'>

= | Assignment | MessageExpression <'.'>

Assignment = ? ObjName ? <':='> ? Expr <'.'>

Rect::move!(dx,dy) = [< x1 := (x1+dx). x2 := (x2+dx). y1 := (y1+dy). y2 := (y2+dy). draw().

].

No Backlinks