misc/kforth: Start over.
This commit is contained in:
parent
7c5297118a
commit
a1149654d4
|
@ -0,0 +1,23 @@
|
||||||
|
CXXSTD := c++14
|
||||||
|
CXXFLAGS := -std=$(CXXSTD) -Wall -Werror -O0 -g
|
||||||
|
LDFLAGS := -static
|
||||||
|
OBJS := linux/io.o \
|
||||||
|
io.o \
|
||||||
|
system.o \
|
||||||
|
parser.o \
|
||||||
|
word.o \
|
||||||
|
dict.o \
|
||||||
|
kforth.o
|
||||||
|
TARGET := kforth
|
||||||
|
|
||||||
|
all: $(TARGET)
|
||||||
|
|
||||||
|
$(TARGET): $(OBJS)
|
||||||
|
$(CXX) $(LDFLAGS) -o $@ $(OBJS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJS) $(TARGET)
|
||||||
|
|
||||||
|
install: $(TARGET)
|
||||||
|
cp $(TARGET) ~/bin
|
||||||
|
chmod 0755 ~/bin/$(TARGET)
|
|
@ -0,0 +1,14 @@
|
||||||
|
#ifndef __KF_PLATFORM_DEFAULT_H__
|
||||||
|
#define __KF_PLATFORM_DEFAULT_H__
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
typedef int KF_INT;
|
||||||
|
typedef uintptr_t KF_ADDR;
|
||||||
|
|
||||||
|
constexpr static size_t STACK_SIZE = 48 / sizeof(KF_INT);
|
||||||
|
constexpr static size_t DICT_SIZE = 4096;
|
||||||
|
constexpr static size_t ARENA_SIZE = 256;
|
||||||
|
|
||||||
|
|
||||||
|
#endif // __KF_PLATFORM_DEFAULT_H__
|
|
@ -0,0 +1,12 @@
|
||||||
|
#ifndef __KF_DEFS_H__
|
||||||
|
#define __KF_DEFS_H__
|
||||||
|
|
||||||
|
|
||||||
|
#if PLATFORM == PC
|
||||||
|
#include "pc/defs.h"
|
||||||
|
#else
|
||||||
|
#include "default/defs.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif __KF_DEFS_H__
|
|
@ -13,6 +13,7 @@ Contents:
|
||||||
part-0x05
|
part-0x05
|
||||||
part-0x06
|
part-0x06
|
||||||
part-0x07
|
part-0x07
|
||||||
|
part-0x08
|
||||||
|
|
||||||
Indices and tables
|
Indices and tables
|
||||||
==================
|
==================
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
Write You a Forth, 0x08
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
:date: 2018-03-01 19:31
|
||||||
|
:tags: wyaf, forth
|
||||||
|
|
||||||
|
After reading some more in Threaded Interpreted Languages (TIL_ from now on),
|
||||||
|
I've decided to start over.
|
||||||
|
|
||||||
|
.. _TIL: http://wiki.c2.com/?ThreadedInterpretiveLanguage
|
||||||
|
|
||||||
|
Some design choices that didn't really work out:
|
||||||
|
|
||||||
|
+ the system structure
|
||||||
|
+ not making it easier to test building for different platforms
|
||||||
|
+ my linked list approach to the dictionary
|
||||||
|
+ my class-based approach to words
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
#ifndef __KF_PLATFORM_PC_H__
|
||||||
|
#define __KF_PLATFORM_PC_H__
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
typedef int32_t KF_INT;
|
||||||
|
typedef uintptr_t KF_ADDR;
|
||||||
|
|
||||||
|
constexpr static size_t STACK_SIZE = 65535;
|
||||||
|
constexpr static size_t DICT_SIZE = 65535;
|
||||||
|
constexpr static size_t ARENA_SIZE = 65535;
|
||||||
|
|
||||||
|
|
||||||
|
#endif // __KF_PLATFORM_PC_H__
|
Loading…
Reference in New Issue