mechaniputer / libredssp Goto Github PK
View Code? Open in Web Editor NEWA GPL Licensed DSSP Interpreter
License: GNU General Public License v3.0
A GPL Licensed DSSP Interpreter
License: GNU General Public License v3.0
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.
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.
Tabs should be treated like spaces
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.
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.
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.
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.
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;
See TODO items in stack.c
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. 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.
For example if I do ."hello
(note the missing endquote)
then it currently prints "hell"
The provided files for syntax highlighting have undesirable behavior in several situations:
This line has some problems due to the negative numbers:
: step6b -4 double BR -8 step6good ELSE step6bad ;
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.