Forth.Net.Program
2.0.6
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet tool install --global Forth.Net.Program --version 2.0.6
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local Forth.Net.Program --version 2.0.6
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Forth.Net.Program&version=2.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
nuke :add-package Forth.Net.Program --version 2.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Forth.Net
An implementation of the Forth programming language for the .Net Framework. You can use it as a C# library, interactively with a CLI or compile the code to a compact binary format.
Installation
dotnet tool install -g forth.net.program
Usage
# Start the CLI.
nforth
# Interpret some files and exit.
nforth Test1.fth Test2.fth -e bye
# Compile files to binary
nforth Test1.fth Test2.fth -e 's\" myfile.io" save'
Notes
- You save the user portion of the dictionary with
S" myfile.io" save
. You load it withS" myfile.io" load
. - You save the whole dictionary, system included, with
S" myfile.io" savesys
. You load it withS" myfile.io" loadsys
. - Calling into .NET APIs is achieved with these simple words. (fyi just static methods with string or numbers for now).
: escape s" System.Uri, System" s" EscapeDataString" .net ;
: sqrt s" System.Math" s" Sqrt" .net ;
- Calling from .NET to Forth is achieved using the public APIs on the
Vm
class. Look at theProgram
folder for a simple example. - See all the suppurted words with
words
. - Perform a system test with
testsys
. Your results should look like at the bottom of this doc. - Type
debug
if curious. - Type
nforth --help
for less used options.
CR CR SOURCE TYPE ( Preliminary test ) CR
SOURCE ( These lines test SOURCE, TYPE, CR and parenthetic comments ) TYPE CR
( The next line of output should be blank to test CR ) SOURCE TYPE CR CR
( Pass #1: testing 0 >IN +! ) 0 >IN +! SOURCE TYPE CR
( Pass #2: testing 1 >IN +! ) 1 >IN +! xSOURCE TYPE CR
( Pass #3: testing 1+ ) 1 1+ >IN +! xxSOURCE TYPE CR
( Pass #4: testing @ ! BASE ) 0 1+ 1+ BASE ! BASE @ >IN +! xxSOURCE TYPE CR
( Pass #5: testing decimal BASE ) BASE @ >IN +! xxxxxxxxxxSOURCE TYPE CR
( Pass #6: testing : ; ) : .SRC SOURCE TYPE CR ; 6 >IN +! xxxxxx.SRC
( Pass #7: testing number input ) 19 >IN +! xxxxxxxxxxxxxxxxxxx.SRC
( Pass #8: testing VARIABLE ) VARIABLE Y 2 Y ! Y @ >IN +! xx.SRC
( Pass #9: testing WORD COUNT ) 5 MSG abcdef) Y ! Y ! >IN +! xxxxx.SRC
( Pass #10: testing WORD COUNT ) MSG ab) >IN +! xxY ! .SRC
Pass #11: testing WORD COUNT .MSG
Pass #12: testing = returns all 1's for true
Pass #13: testing = returns 0 for false
Pass #14: testing -1 interpreted correctly
Pass #15: testing 2*
Pass #16: testing 2*
Pass #17: testing AND
Pass #18: testing AND
Pass #19: testing AND
Pass #20: testing ?F~ ?~~ Pass Error
Pass #21: testing ?~
Pass #22: testing EMIT
Pass #23: testing S"
Results:
Pass messages #1 to #23 should be displayed above
and no error messages
0 tests failed out of 57 additional tests
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.