AltME: Red Docs


I find myself using these docs mostly:
REBOL/Core Users Guide
REBOL Function Dictionary
REBOL/View VID Developer's Guide
DRAW Dialect Reference
The old version of draw-ref.html , which I can't find online, but I have it locally.
But all these are mostly docs or references, maybe not educational for beginners to the language. I can't think of a good beginner guide for these kinds of languages, but I haven't read all, so maybe it exists.

I'm a fan of putting a crap load of stuff on a single page, esp. "Most common used words" with lots of examples.
In general though, I go to Google, type things like "rebol parse example" and get good enough.

I want to make a Red/System doc for assisting programming Red. The idea is to quickly look up the definitions of all the used types. Such a document will be useful for Red/System 1.0 but will be easily extended for Red/System 2.0 later.
Not sure what you mean by "used types", but any docs are helpful.

cell!, red-value!, red-block! red-string! etc. On the one side I would like a paper version, so an index and all. On the other side a little referential program to help you look up items fast and not searching through the sources yourself, but maybe it should use the sources.
Ah, Red/System datatypes, got it. Using the source is often a lot of work. All clues help people contribute.

That would be helpful Arnold.
Looking for the right datastructure to get the information in, get it presented and perhaps also have it autofilled from the sources?
;name       declaration-type        source-location             [definition]
series!     #define             runtime/allocator.reds      [series-buffer!]
int-array!  alias               runtime/allocator.reds      [struct! [ptr [int-ptr!]]]
cell!       alias               runtime/allocator.reds      [...]
Can't help you there Arnold. Maybe if I can get some other things cleared from my list.

No problem I code something to get a start.
I have a quicky start but ..
whitespace: charset reduce [space tab]
empty-line: ["^/" any whitespace "^/"]
end-alias: "^/]^/"
_allocator: read %../red-master/runtime/allocator.reds
; Now can select the definition of a type declaration
parse _allocator [to "int-array!" copy desc thru [end-alias | empty-line] to end]
; And keep some string for all aliases in the source
type-list: parse _allocator [collect any [to "alias" keep to "^/"]]
; But I want
type-list: parse _allocator [collect any [to "alias" keep backto "^/"]]
As with a list if the strings before the alias I can do something more useful than the end of the strings after 'alias'.
You'll have to collect the comments first. You could set markers, but collecting them first is probably eaiser. e.g.:
_allocator: read %...
ws=: charset " ^-"
ws+=: [some ws=]
ws*=: [any ws=]
empty-line=: ["^/" ws*= "^/"]
=comment:  none
=comments: copy []
comment=: [ws*= ";" copy =comment to newline skip]
comments=: [copy =comments [some [comment= | empty-line=]]]
digit=: charset "0123456789"
word-first-char=: complement charset {/\^^,[](){}"#%$@:;}   ; "
word-inner-char=: union word-first-char= digit=
word=: [copy =word [word-first-char= any word-inner-char=]]
set-word=: [copy =set-word [word= #":"]]
end-alias=: ["^/]^/" | "]]"]
alias=: [
    set-word= ws+= "alias struct!"
    copy =desc thru [end-alias= | empty-line=]
        print =set-word
        print mold =desc
        print mold =comments
        =comments: none
parse _allocator [
    some [
        | alias=
        | skip
The "=" prefix/suffix convention is one I use to mark parse rules and vars.
I was creating the pieces of the puzzle that seemed easiest first.
list: parse _allocator [collect any [[ahead [not [any newline] to "alias" ] keep to "alias" | newline]]]
BuUt this only gets me []  So i'll try your construction now.
Very nice Gregg!

Though I think it is much simpler just to use read/lines and work from there:
_allocator: read/lines %../red-master/runtime/allocator.reds
__allocator: make block! 200
foreach line _allocator [if find line "alias" [append __allocator line]]
And the file in runtime/datatypes/structures.reds that collects the definitions will also be helpful.

word-first-char=: complement charset {/\^^,{}"#%$@:;} ; "
is incomplete? because it does not exclude digits?
red>> parse "0" [word-first-char=]
== true
Good catch Arnold. I was pulling things together quickly.

Last message posted 65 weeks ago.