! Copyright (C) 2008 Matthew Willis ! See http://factorcode.org/license.txt for BSD license. USING: kernel peg.ebnf sequences sequences.lib strings ; IN: lambda.ebnf TUPLE: apply func arg ; C: apply TUPLE: def id term ; C: def EBNF: parse-term s = ' '* id = [a-zA-Z]+ => [[ >string ]] paren = '(' term-list ')' => [[ second ]] term = paren | id sterm = s term s => [[ second ]] term-list = (sterm)+ => [[ [ ] reduce* ]] def = id s ':=' term-list => [[ [ first ] [ fourth ] bi ]] stmt = def | term-list ;EBNF