💾 Archived View for bbs.geminispace.org › s › FORTH › 5339 captured on 2024-06-16 at 19:34:21. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2024-05-26)

➡️ Next capture (2024-07-09)

🚧 View Differences

-=-=-=-=-=-=-

Comment by 🚀 stack

Re: "Loading files in nForth: implementation"

In: s/FORTH

@karel, that is fine if it works for you, and I could've had the assembler append other forth files (it alread appends 'nforth.f'). But it turned out to be dead simple:

: included; \ (fname,cnt--)
  drop zero dup rot osopen
  pop drop \ do not return to brace
  loadh 
;

And in the process I got the sync/abort logic working.

So I do append one file, nforth.f, which normally defines included; and uses it to bootstrap itself by loading nf.f. But the user can stuff anything into nforth.f, say for a single file CGI script.

🚀 stack [OP/mod]

2023-09-15 · 9 months ago

Original Post

🌒 s/FORTH

Loading files in nForth: implementation — Having implemented the normally-compile semantics I discussed in the previous post, I must now tackle the `include` functionality to load more forth code from a file. The problem: since nForth is now a compterpreter (it compiles code and runs/erases it to simulate interpretation), we must compile and run the loading code and the filename into the dictionary to execute the load. If we blindly load on top, the pseudo-interpretive block of code that does...

💬 stack [mod] · 2 comments · 2023-09-14 · 9 months ago