|
From: | Vladimir Serbinenko |
Subject: | Re: Scripting support |
Date: | Sat, 22 Oct 2005 17:37:19 +0200 |
User-agent: | Mozilla Thunderbird 1.0.6 (X11/20050804) |
Hello
In bash when you define a function it appears under environment variables. IMHO it's useless to store completely the source code as an environment variables. I propose that the functions will be preparsed (converted to internal format ready for execution) because it will gretelya simplify lexer and parserRight. We should discuss the internal format on the list, I think.Right. And this can be kept quite simple. The commands itself are just a string of text. The loops just check a variable, no? It can be something like: for foo in 1 2 3 do echo $i done That can be translated into some kind of pseudo language: 1: list = 1 2 3 2: read i, list 3: echo $i 4: check list 5: je 2 I know it's stupid and kind of silly like this. But we have to define a language. It's important to discuss this on the list, IMO.
I thought about (a):1: command=forin variable=i list=1 2 3 end=NULL /* it will be 4 if script continues*/
2: echo $i 3: jump 1 Or (b): 1:splitpush 1 2 3 2:pop list 3:read i, list 4:push list 5:echo $i 6:pop list 7:check list 8:push list 9:je 2 10:pop listThe question is how many commands to make: a lot (like in a where nearly every internal command corresponds to a scripting command) or make so few commands as possible. I wonder which approach is better (it's question about bugs and readibility, of course, not about speed)
Which mail are you talking about (subject and date)? I must have missed a few the last months. :-(
Re: [Patch] Scripting engine 25.09.2005 [Patch] Scripting engine 24.08.2005It's just demonstration of some ideas. Now I think with new splitter it would be better to keep arglist unparsed. In this patch it was that if we have
echo 1 2 3\;\$ ab$i; lexer returns (schematically) STRING(echo) STRING(1) STRING(2) STRING (3;$) STRING(abVAR(i)) SEMICOLON now I would do that it returns: STRING(echo 1 2 3\;\$ ab$i) SEMICOLONVladimir 'phcoder' Serbinenko
[Prev in Thread] | Current Thread | [Next in Thread] |