Coder Social home page Coder Social logo

korolevsoftware / forth-embed Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 70 KB

Forth-embed

License: Apache License 2.0

CMake 2.81% C 97.19%
c embedded forth interpreter concatenative language programming-language stack gamedev scripting-language script-engine scripting-engine scripting-languages

forth-embed's Introduction

Forth-embed

Data type only integer

Coming soon release! check todo

VS-Code support!

Stack operations:

  • dup
  • drop
  • swap
  • over
  • rot

Prints:

  • emit
  • cr
  • ."

Print example: ."hello world"

Сomparisons:

  • =
  • <
  • >
  • invert
  • and
  • or

Math:

  • +
  • -
  • /
  • *
  • mod

Controll flow:

  • if
  • else
  • then
  • do
  • i
  • loop
  • begin
  • until
  • :
  • ;

Variables/Constants

  • constant
  • variable
  • allot
  • cells
  • @
  • !
#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 - game engine with forth from script engine

forth-embed's People

Contributors

korolevsoftware avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.