Paste: engramme parser

Author: Jon
Mode: factor
Date: Fri, 11 Jun 2010 22:49:03
Plain Text |
! A parser for the numeration system described here
! http://instinctive.eu/articles/systeme-numeration-exotique
! (French !)

! Copyright (C) 2010 Jon Harper.
! See http://factorcode.org/license.txt for BSD license.
USING: math peg.ebnf sequences ;
IN: engramme-parser
plain = [0-1] => [[ CHAR: 0 - ]]
recursive = "(" engramme* ")" => [[ rest but-last ]]
engramme = plain      => [[ ]] 
         | recursive  => [[ first ]]
;EBNF

Annotation: Add the missing EBNF:

Author: Sam
Mode: factor
Date: Sat, 12 Jun 2010 11:22:20
Plain Text |
! A parser for the numeration system described here
! http://instinctive.eu/articles/systeme-numeration-exotique
! (French !)

! Copyright (C) 2010 Jon Harper.
! See http://factorcode.org/license.txt for BSD license.
USING: math peg.ebnf sequences ;
IN: engramme-parser
EBNF: engramme
plain = [0-1] => [[ CHAR: 0 - ]]
recursive = "(" engramme* ")" => [[ rest but-last ]]
engramme = plain      => [[ ]] 
         | recursive  => [[ first ]]
;EBNF

Annotation: You can make it simpler

Author: Sam
Mode: factor
Date: Sat, 12 Jun 2010 11:37:42
Plain Text |
USING: math peg.ebnf sequences ;
IN: engramme-parser

EBNF: engramme
plain = [0-1] => [[ CHAR: 0 - ]]
recursive = "(" engramme* ")" => [[ second ]]
engramme = plain | recursive
;EBNF

New Annotation

Summary:
Author:
Mode:
Body: