Last active
December 16, 2015 10:29
-
-
Save letoh/5420485 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void vm_exec_xt(vm_t *vm, xt_t *xt) | |
| { | |
| ... | |
| CODE(COLON): | |
| /* ( C: "<spaces>name" -- colon-sys ) */ | |
| { | |
| char *token = tib_getToken(vm->tib, vm->src, " \n\t\r"); | |
| word_t *w = dict_addword(vm->dict, token, ATTR_HIDDEN, (xt_t)&&F_ENTER); | |
| } | |
| vm->state = 1; | |
| ENDCODE; | |
| CODE(SEMICOLON): | |
| /* Compilation: ( C: colon-sys -- ) | |
| Run-time: ( -- ) ( R: nest-sys -- ) */ | |
| //dict_addcell(vm->dict, (cell_t)&&F_EXIT); | |
| dict_addcell(vm->dict, (cell_t)&(dict_find(vm->dict, "(exit)")->code)); | |
| vm->dict->last->hidden = 0; | |
| vm->state = 0; | |
| ENDCODE; | |
| CODE(DOLIT): | |
| //printf("[code] dolit: push %d\n", (cell_t)*vm->ip); | |
| stack_push(ds, (cell_t)*vm->ip); | |
| vm->ip++; | |
| ENDCODE; | |
| CODE(DOVAR): | |
| //printf("[code] (var): push %p\n", (cell_t)(vm->ip + 1)); | |
| stack_push(ds, (cell_t)(vm->ip + 1)); | |
| ENDCODE; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $COLON MACRO LEX,NAME,LABEL | |
| $CODE LEX,NAME,LABEL | |
| NOP ;;align to cell boundary | |
| CALL DOLST ;;include CALL doLIST | |
| ENDM | |
| ; doVAR ( -- a ) | |
| ; Run time routine for VARIABLE and CREATE. | |
| $COLON COMPO+5,'doVAR',DOVAR | |
| DW RFROM,EXIT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment