Hi all-
I'm working on a language grammar for Forth, and am hoping I could get some advice or pointers for my work. I've read the TextMate manual, and James Gray's fine book, although I'm sure I haven't extracted every nugget of info from those texts.
As some of you may be aware, Forth is a stateful language, and there are certain keywords that are valid only when Forth is compiling. For example, some words, like IF, THEN and ELSE, can be used only within a word (function) definition.
So it would be nice to capture this in the scope, and assign these compile-only words to an "invalid" scope when they are used outside a function definition. The question is, how to (best) do this?
I've looked at the C language definition a bit, and clearly there are two modes there: "preprocessing", and "not". But with Forth, I should be able to assign an invalid scope to the top-level; in essence, have an invalid scope for source.forth.
Any thoughts?
Best, Charles