r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Parse] Discussion of PARSE dialect

btiffin
24-Jan-2008
[2309]
I'm pondering attempting a PARSE lecture here on Altme;  It'd be 
run twice, 9am EST, 9pm EST (or somesuch)  Topic would be dialecting. 
 I want to see if it would work, but I'm no where near a professor 
level rebol.  So, think of it as a kindergarten lecture, as a trial.


Plan;  Post this message - see if there is feedback.  Allow for some 
Q&A time for specific topics of interest.  A week or two later, run 
a hour (probably less) of monologue (interruptions allowed for stuff 
that is just plain wrong ... but other than that participants would 
be asked to hold off on questions).  Followed immediately with a 
Q&A, complaint, correction session.  Then a DocBase page created 
with a merged transcript of the two timezoned lectures, things learned 
and hopefully something along the lines of a simple file management 
(or some such) dialect source code file.  R2 related - for me the 
R3 DELECT still hasn't sunk in.  If it works, then perhaps it could 
become a semi-regular activity...there is going to be a lot to discuss 
come "link to the rebol.dll" time.
amacleod
24-Jan-2008
[2310]
sounds good
Pekr
24-Jan-2008
[2311]
If it is not supposed to be interactive, you could as well prepare 
it in a form of DocBase article, and then run the session ...
btiffin
24-Jan-2008
[2312]
Petr; true.  It is meant to be interactive, but after a monologue 
phase.  I worry a little bit as I have a sad tendency to be "almost 
right" with REBOL so I'd want the material vetted over before unleashing 
it on the innocent.
SteveT
25-Jan-2008
[2313]
As 'the'  newbie !! I'd 'Pay' for that! ;-)
james_nak
25-Jan-2008
[2314]
That would be great.
btiffin
25-Jan-2008
[2315]
Ok; I'll accept a class size of as least three as enough to make 
it worth continuing.  please be advised; The teacher can be a complete 
moron every second or third minute so the participants will be asked 
to take any knowledge gained as "maybe correct".  :)  I hope and 
expect that any semi-correct information will be fully corrected 
by the community before the information leaks too far afield.  Raising 
parse takes a village.
SteveT
26-Jan-2008
[2316]
Can you let me know what time in th UK the lecture may be ?? Ta
btiffin
26-Jan-2008
[2317]
Yeah; I'll work out two time slots;  still leaning toward 9am EST, 
-5 hours on GMT, and 9pm.  On a Saturday/Sunday.  
More to come.
btiffin
2-Feb-2008
[2318]
Poll re lecture;  How many people "get" pattern matching?  The whole 
success, fail and backtracking over alternates thing?  Does the class 
start with that level of description or right into parse?
Brock
2-Feb-2008
[2319]
I would be most interest in parse info.  My big interest is how parse 
can be used in conjunction with domain specific languages, but realize 
that might be scope creep.
btiffin
2-Feb-2008
[2320]
Nope on the creep;  A DSL will be the outcome of the lecture.  I'm 
leaning either toward a password management dialect or a (simple) 
file management command set.
Brock
3-Feb-2008
[2321]
great, looking forward to it
Geomol
3-Feb-2008
[2322]
A bit related, which might be a help in understanding parse in any 
way:

I want to know. how fast rebcode is at emulating CPUs, so I'm developing 
a 6502 assembler using parse and want to emulate the 6502 CPU using 
rebcode at a later time. When the assembler is more finished, I'll 
release it with a GPL license. It's basically a bunch of parse rules.
Gregg
3-Feb-2008
[2323x2]
James is getting into Forth, and I was just looking at some old notes 
I made on ForthR (play on "further"), where the machine primitives 
are actually a little REBOL VM/emulator, rather than ASM for a specific 
chip. Easier to get started, though not real Forth.
I've always thought we should have examples of how languages can 
be implemented in REBOL.
Graham
4-Feb-2008
[2325]
I have the figforth assembly code for the 6502  ... so you could 
run fig forth on your 6502 emulator ?
Gregg
4-Feb-2008
[2326]
Yeah, let me see where I put that... :-)
Geomol
4-Feb-2008
[2327]
I'm not really sure. First I do a general 6502 assembler and emulator, 
but I only have an emulator of the BBC homecomputer to test up against, 
so I probably have to deal with some Operating System stuff too. 
I operate with a 64k address space, and on the BBC writing to some 
certain addresses made something special for that platform happen. 
But let's see, what we can do.
Henrik
4-Feb-2008
[2328]
slightly off topic: who was it that wrote a z80 emulator with embedded 
space invaders?
BrianH
4-Feb-2008
[2329]
Steeve, and it was Galaga.
Henrik
4-Feb-2008
[2330]
there should be some follow up on it. it's been forgotten a bit
BrianH
4-Feb-2008
[2331]
I'm not sure that it would be a good idea to make new rebcode projects 
until rebcode is reintroduced, unless the purpose of the project 
is to provide reference data for the redesign of rebcode.
Henrik
4-Feb-2008
[2332]
yes something like that. I wouldn't expect it for a second to run 
on R3, even if Rebcode goes in. but I think it makes a good chuck 
of code for rebcode testing.
Geomol
4-Feb-2008
[2333x2]
I had the impression, that it was most the names of the rebcodes, 
that would change. Then it should be too much work to port existing 
rebcode over.
shouldn't
BrianH
4-Feb-2008
[2335x2]
Remember: Rebcode redesign. Lots of legacy code is not a good idea 
unless noone has a problem with it not running on the new version. 
There are a lot of problems with the current design, and it seems 
likely that there will be changes to the semantics, not the names.
The current design doesn't provide that much of a speedup over regular 
R3 code, mostly because of the stack variable change.
Geomol
4-Feb-2008
[2337x2]
ok
I'm on the parsing assembler part, so no rebcode yet here.
Carl
4-Feb-2008
[2339x2]
So... the trick in RebCode for using it in R3 is how to efficiently 
access variables.
In R3 variables are more protected than in R2.  But, perhaps we can 
do something with temporaries on stack that require fewer tests, 
but have limited usage patterns.
Pekr
4-Feb-2008
[2341]
But weeee want RebCode. Hopefully it comes. Even if slower than R2 
version. We will see - maybe C based plug-ins and proper porting 
efforts have more sense, dunno ...
Geomol
5-Feb-2008
[2342]
I finished v. 1.0.0 of 6502 assembler: http://www.fys.ku.dk/~niclasen/rebol/language/asm6502.r

It defines the asm6502 function, which take 6502 assembler as text 
input and produces 6502 machine code (opcodes). Might be a good example 
of parsing in REBOL.
btiffin
5-Feb-2008
[2343]
Go John Go!
Geomol
5-Feb-2008
[2344]
:)
Graham
5-Feb-2008
[2345]
Oh ...I thought we were going to see a 6502 emulator!
Geomol
5-Feb-2008
[2346]
One step at a time!
Graham
5-Feb-2008
[2347]
single stepping?
Geomol
5-Feb-2008
[2348x3]
Yeah, I'm only a level 1multitasker or so.
You see, now I have a 6502 assembler written in REBOL, so now it 
will be easy for me to test a 6502 emulator, while I'm writing it.
I've found, that it's best to test while I develop. It's traditionally 
design-programming-test. I don't find this the best way, if you want 
fast progress and few errors.
btiffin
5-Feb-2008
[2351]
Agreed;  write a line, test a line.  

Personal comment:

Then forget you wrote it so a few days later you can  write a line, 
test a line and then go "whoa, deja-vu"  :)
Gregg
5-Feb-2008
[2352]
Since it's line-based, could the syntax error tell you which line, 
in addition to what op it's near?
Geomol
5-Feb-2008
[2353x2]
Yes, for the syntax errors it's fixed now: http://www.fys.ku.dk/~niclasen/rebol/language/asm6502.r

For labels not found, you have to search you source, where you branch 
to that label.
It's a one pass assembler and then some. After first pass, it checks, 
if there is forward referencing to labels and then fix those relative 
addresses directly in the produced code. Should be fast, as it's 
not a completely two-pass.
Gregg
5-Feb-2008
[2355]
I haven't played with it, but it's still veyr impressive for such 
a short project.
Geomol
5-Feb-2008
[2356]
It's about 10k REBOL source. 2644 bytes compressed.

It amuses me to use REBOL for things like this. The most enjoyable 
language around! It took me like 3 halves evenings.
btiffin
5-Feb-2008
[2357]
Elite, John.  Elite.
Geomol
5-Feb-2008
[2358]
Instructions can be separated by : on the same line, and comments 
put at the end. Example:
asm6502 "inx:iny This is a comment!"
UPPER/lower case can be used:
asm6502 "INX : INY This is a comment!"