Paste: parsing plain text

Author: stablerobber
Mode: factor
Date: Fri, 19 Mar 2010 09:10:44
Plain Text |
: v-read ( -- file-contents )
    "/Volumes/Jingo 1T/AdminDocs/fakeproj/desc" utf8 file-contents ;

: -ends ( seq -- seq' )    [ blank? ] trim ;

: seg ( seq -- seq' )    [ blank? ] split-when ;

: -spc ( seq -- seq' )    "" swap remove ;

: wrdlst ( seq -- seq )   -ends seg -spc ;

: getfl ( -- seq )   v-read wrdlst  ;

! so up to here is just getting the file and dividing it into words.

SYNTAX:   def1 ( --  ) [ getfl first
                         ! 1 string is on the stack
                         define-symbol ]  
                             with-compilation-unit ;

Annotation: done

Author: stablerobber
Mode: factor
Date: Fri, 19 Mar 2010 10:24:24
Plain Text |
! okay so this is how it ended up
! all the pieces were there, it was just a few little things

: def2 ( -- )
      "new-word-name" "vocab-name"
      [ create define symbol ] with-compilation-unit ;

New Annotation

Summary:
Author:
Mode:
Body: