World: r3wp
[Parse] Discussion of PARSE dialect
older newer | first last |
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 [2358x6] | 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!" |
btiffin, hehe :) | |
The asm6502 can take the refinement /at to tell the starting address in the 64kb ram area for the produced code. I don't like the refinement being called /at, because we already have the word AT. Any suggestions for a better name? | |
The Program Counter get set to the argument for that refinement, else 1, if the refinement isn't there. | |
So it could be named something like: /pc /target /address /start ... | |
/begin maybe? | |
older newer | first last |