Commit ca81eeb5 authored by Bernd Paysan's avatar Bernd Paysan
Browse files

Recognizer included

parent b76ea60e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -181,6 +181,7 @@ KERN_SRC = \
	kernel/basics.fs \
	kernel/int.fs \
	kernel/comp.fs \
	kernel/recognizer.fs \
	kernel/io.fs \
	kernel/input.fs \
	kernel/license.fs \
+7 −1
Original line number Diff line number Diff line
@@ -765,6 +765,7 @@ Plugin ?do, ( -- ?do-token )
Plugin for,	( -- for-token )
Plugin loop,	( do-token / ?do-token -- )
Plugin +loop,	( do-token / ?do-token -- )
Plugin -loop,	( do-token / ?do-token -- )
Plugin next,	( for-token )
Plugin leave,	( -- )
Plugin ?leave, 	( -- )
@@ -1726,7 +1727,7 @@ T has? relocate H

Ghost (do)      Ghost (?do)                     2drop
Ghost (for)                                     drop
Ghost (loop)    Ghost (+loop)                   2drop
Ghost (loop)    Ghost (+loop)   Ghost (-loop)   2drop drop
Ghost (next)                                    drop
Ghost !does                                     drop
Ghost compile,                                  drop
@@ -3233,6 +3234,10 @@ Cond: ENDCASE endcase, ;Cond
  1to compile (+loop)  loop] 
  compile unloop skiploop] ;			' (+loop,) plugin-of +loop,

: (-loop,) ( target-addr -- )
  1to compile (-loop)  loop] 
  compile unloop skiploop] ;			' (-loop,) plugin-of -loop,

: (next,) 
  compile (next)  loop] compile unloop ;	' (next,) plugin-of next,

@@ -3242,6 +3247,7 @@ Cond: FOR for, ;Cond

Cond: LOOP	1 ncontrols? loop, ;Cond
Cond: +LOOP	1 ncontrols? +loop, ;Cond
Cond: -LOOP	1 ncontrols? -loop, ;Cond
Cond: NEXT	1 ncontrols? next, ;Cond

\ String words                                         23feb93py
+17 −0
Original line number Diff line number Diff line
@@ -141,6 +141,22 @@ DOES> ( -- r )
	2drop false
    THEN ;

[ifdef] recognizer:
    ' noop
    :noname postpone Fliteral ;
    dup
    recognizer: r:fnumber

    :noname ( addr u -- nt int-table true | addr u false )
    2dup sfnumber  dup
    IF
	drop 2drop r:fnumber  true
    THEN ; Constant fnum-recognizer

fnum-recognizer
forth-recognizer get-recognizers
1+ forth-recognizer set-recognizers
[else]
[ifundef] compiler-notfound1
defer compiler-notfound1
' no.extensions IS compiler-notfound1
@@ -170,6 +186,7 @@ IS compiler-notfound1
	defers interpreter-notfound1
    ENDIF ;
IS interpreter-notfound1
[then]

: fvariable ( "name" -- ) \ float f-variable
    Create 0.0E0 f, ;
+6 −0
Original line number Diff line number Diff line
@@ -364,9 +364,13 @@ has? primcentric [IF]
	swap POSTPONE aliteral compile,
    then ;

has? recognizer [IF]
    include ./recognizer.fs
[ELSE]
: POSTPONE ( "name" -- ) \ core
    \g Compiles the compilation semantics of @i{name}.
    COMP' postpone, ; immediate
[THEN]

\ \ recurse							17may93jaw

@@ -376,6 +380,7 @@ has? primcentric [IF]

\ \ compiler loop

has? recognizer 0= [IF]
: compiler1 ( c-addr u -- ... xt )
    2dup find-name [ [IFDEF] prelude-mask ] run-prelude [ [THEN] ] dup
    if ( c-addr u nt )
@@ -403,6 +408,7 @@ has? primcentric [IF]
: ] ( -- ) \ core	right-bracket
    \G Enter compilation state.
    ['] compiler1     IS parser1 state on  ;
[THEN]

\ \ Strings							22feb93py

+2 −0
Original line number Diff line number Diff line
@@ -693,6 +693,7 @@ has? backtrace [IF]
    then ;
[THEN]

has? recognizer 0= [IF]
\ not the most efficient implementations of interpreter and compiler
: interpreter1 ( c-addr u -- ... xt ) 
    2dup find-name [ [IFDEF] prelude-mask ] run-prelude [ [THEN] ] dup
@@ -709,6 +710,7 @@ has? backtrace [IF]
    then ;

' interpreter1  IS  parser1
[THEN]

\ \ Query Evaluate                                 	07apr93py

Loading