https://github.com/korolevsoftware/forth-embed
Forth-embed
https://github.com/korolevsoftware/forth-embed
c concatenative embedded forth gamedev interpreter language programming-language script-engine scripting-engine scripting-language scripting-languages stack
Last synced: 10 days ago
JSON representation
Forth-embed
- Host: GitHub
- URL: https://github.com/korolevsoftware/forth-embed
- Owner: KorolevSoftware
- License: apache-2.0
- Created: 2023-11-14T15:21:38.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-25T19:24:37.000Z (over 1 year ago)
- Last Synced: 2025-02-16T21:42:04.585Z (3 months ago)
- Topics: c, concatenative, embedded, forth, gamedev, interpreter, language, programming-language, script-engine, scripting-engine, scripting-language, scripting-languages, stack
- Language: C
- Homepage:
- Size: 68.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Forth-embed
Data type only integer
## Coming soon release! check todoVS-Code support!
Stack operations:
- dup
- drop
- swap
- over
- rotPrints:
- emit
- cr
- ."Print example: ```."hello world"```
Сomparisons:
- =
- <
- \>
- invert
- and
- orMath:
- \+
- \-
- /
- \*
- modControll flow:
- if
- else
- then
- do
- i
- loop
- begin
- until
- :
- ;Variables/Constants
- constant
- variable
- allot
- cells
- @
- !```C
#include "forth_embed.h"void asdf(struct forth_state* fs) {
forth_data_stack_push(fs, 1);
forth_data_stack_push(fs, 2);
forth_data_stack_push(fs, 3);
}struct forth_state* fs = forth_make_default_state();
struct forth_byte_code* program = forth_compile(": aa asdf ; aa . . .");
forth_set_function(fs, "asdf", asdf);
forth_run(fs, program);
forth_run_function(fs, program, "aa");
forth_release_state(fs);
forth_release_byte_code(program);
```# TODO
- make stable release
- write more tests# Usings
[Sima-Engine](https://github.com/KorolevSoftware/Sima-Engine) - game engine with forth from script engine