Git Product home page Git Product logo

libredssp's People

Contributors

cam72cam avatar emberian avatar grissess avatar mechaniputer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

libredssp's Issues

Variables and types

It looks as though variables are supposed to be declared like 'VAR foo' before being assigned a value. Currently the 'VAR' keyword is not implemented and variables can be assigned without first declaring them like: '7 ! foo'

See this document: http://brokestream.com/daf.txt

Declaring a variable with VAR should result in that variable being named, allocated and initialized to zero. Implicitly declaring a variable through the assignment operator should print a warning that this will be deprecated in a future release.

Types should also be supported like this:
WORD VAR foo
BYTE VAR foo

WORD should be the default type, corresponding to the size of the machine word.

Leaks memory like crazy

Need to free stack elements when they are no longer needed in corewords.c. This will be a lot of unique work for each core word.

Need escape character when printing

I don't know if earlier implementations used any particular escape character but at present it is not possible to use the ."hello" printing syntax to print a double quote. Should research whether any particular character has historically been used for this in DSSP. Otherwise just pick a sane one.

Impossible to cleanly exit interpreter during multi line statement

When in the middle of a multi line comment or function definition, a ? prompt is displayed and evaluation of the command stack is deferred. This makes it impossible to exit the interpreter. CTRL+D should exit the interpreter in this situation, but typing BYE should not because it is acceptable to declare a multi line function that uses that word.

Cannot define function inside another function

I see no reason why it should be illegal to define one function inside another function definition. Sure it's kind of an evil thing to do, but it should be technically allowable.

The current behavior allows it at the parser level but when evaluating the command stack, the inner semicolon terminates the outer function definition, and then the next semicolon is treated as a stray character.

Maybe handling this case will be easier after an inevitable complete REPL rewrite.

Parser is horrible

The piece of code that takes a line of input (from either a file or the interactive prompt) and divides it into commands is especially horrible and error-prone. The command stack itself should probably be rewritten as a queue so that the parser doesn't need to fill a linked list before adding anything to the stack (in reverse order). It could instead just put stuff right into the back of the queue.

This calls for a fundamental redesign of the way commands are processed prior to being evaluated. This is the worst part of the code right now and also the most annoying to rewrite. It greatly affects the efficiency and safety of the interpreter so it is a high priority.

Spacing in word declarations

Original sources seem to indicate that a space preceding the ';' symbol in a function/word declaration is not necessary. Currently libreDSSP requires a space there. This requirement should be relaxed.

For example:
: one 1 ;
could also be written as
: one 1;

DO word can segfault

The current implementation of DO (internally named doloop) at line 294 of corewords.c has serious bugs.

The simplest way to observe the problem is to run:
2 DO .

A similar problem occurs when running the following command twice in a row:
3 DO .

The first execution triggers an error about an empty string being present in the command stack and aborts execution. The second execution triggers a segmentation fault.

The problems associated with this command derive from the nature of what it must do. In order to repeat a command, it places multiple copies of that command onto the command stack. Because the stack is implemented as an array, a realloc can cause references to become invalid. Additionally, a push can overwrite an element which has been popped. I'm not sure if either of those cases are relevant to the current bug.

Multiline comments and function definitions not supported

Multiline comments and function definitions not supported. To fix this, defer evaluating command stack until after the necessary terminating character is found in a future line. The prompt style should change to a '?' as well.

Vim syntax highlighting buggy

The provided files for syntax highlighting have undesirable behavior in several situations:

  1. When there are several comments on a line with code between them
  2. . and .. are not highlighted
  3. Function declarations are not fully highlighted if they contain non-alphanumeric characters
  4. It would be nice to also highlight the ';' at the end of a function declaration

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.