2

开始 FORTH的第 3 章说,

现在您已经创建了一个“当前”块,您可以通过简单地输入单词来列出它L。与 不同LISTL不希望按块号进行;相反,它列出了当前块。

当我跑步时180 LIST,我得到

Screen 180 not modified     
0                                                                 
...                                                             
15                                                                 
 ok

但是当我运行时L,我得到一个错误

:30: Undefined word
>>>L<<<
Backtrace:
$7F0876E99A68 throw 
$7F0876EAFDE0 no.extensions 
$7F0876E99D28 interpreter-notfound1 

我究竟做错了什么?

4

4 回答 4

9

是的,gForth 支持内部(BLOCK)编辑器。启动 gforth

  1. 类型:(use blocked.fb演示页面)
  2. 类型:1 load
  3. 类型editor
  4. words将显示编辑器的话,

    s b n bx nx qx dl il f y r d i t 'par 'line 'rest c a m  ok
    
  5. 键入0 l以列出描述编辑器的屏幕 0,

    Screen 0 not modified     
     0 \\ some comments on this simple editor                 29aug95py
     1 m marks current position        a goes to marked position       
     2 c moves cursor by n chars       t goes to line n and inserts    
     3 i inserts                       d deletes marked area           
     4 r replaces marked area          f search and mark               
     5 il insert a line                dl delete a line                
     6 qx gives a quick index          nx gives next index             
     7 bx gives previous index                                         
     8 n goes to next screen           b goes to previous screen       
     9 l goes to screen n              v goes to current screen        
    10 s searches until screen n       y yank deleted string           
    11                                                                 
    12 Syntax and implementation style a la PolyFORTH                  
    13 If you don't like it, write a block editor mode for Emacs!      
    14                                                                 
    15                                                                 
     ok
    

创建自己的块文件

创建自己的新块文件myblocks.fb

  1. 类型:use blocked.fb
  2. 类型:1 load
  3. 类型editor

然后

  1. 类型use myblocks.fb
  2. 1 load将显示 BLOCK #1(第 0 行到第 15 行。16 行,每行 64 个字符)
  3. 1 t将突出显示第 1 行
  4. 键入i this is text以 [i] 插入到第 1 行
  5. 编辑当前 BLOCK 类型flush后,将 BLOCK #1 写入文件myblocks.fb

有关更多信息,请参阅gForth 块

于 2018-09-23T12:02:11.763 回答
2

原来这些是书中所说的“编辑器命令”,

对于那些编辑不遵守这些规则的人

FORTH-79 标准没有指定编辑器命令。您的系统可能使用不同的编辑器;如果是这样,请检查您的系统文档

我不相信 gforth 根本不支持内部编辑器。所以L, T, I, P, F, E, D,R都可能不受支持。

于 2018-02-17T01:53:56.543 回答
1

gforth 与 emacs 很好地集成在一起。在我这里的 xemacs 中,默认情况下,任何名为 *.fs 的文件都被视为 FORTH 源。像往常一样,“Ch m”给出了可用的命令。

于 2018-04-24T16:34:10.317 回答
0

不,GNU Forth 没有内部编辑器。我使用 Vim :)

于 2018-02-22T07:22:13.233 回答