Forth isn't just a language, it's also a set of principles. Any given dialect should be adapted to the host environment rather than slavishly adhering to a standard. That said, familiarity is important, so the basics work the same in BaCon Forth as in any other:
? 3 2 + . cr
? : squared dup * ;
? 5 squared . cr
The big difference, that changes everything else, is that BaCon has proper quoted strings:
? do "Hello, world!" type cr
They're used not just for printing out messages, but also for control structures:
? 1 do "dup . cr 1+ dup 3 <=" ?again
? do "i . space" 10 times cr
1 2 3 4 5 6 7 8 9 10
space is buggy as of version 0.8 beta)
Yes, blocks of code are simply literal strings! The trick here is that BaCon Forth uses direct interpretation; even "compiled" words really aren't. Inside a colon definition they're simply built up word by word, so they can span multiple lines in the source and you don't have to worry about nesting quotes. Conversely, control structures are just short-lived anonymous words; that also has some side effects, such as making them usable outside of colon definitions.
Word of caution: in BaCon, you can only use spaces to delimit words. If you embed tabs in a string, don't try to interpret it! Also, strings are one-liners. In fact, BaCon Forth is always interpreted line by line, even when read from a file with
include. Newlines aren't just whitespace.
Unfortunately. that means parenthesized comments must end on the same line.