
On 7/2/21 9:33 AM, Sean Anderson wrote:
On 7/2/21 7:03 AM, Wolfgang Denk wrote:
Dear Sean,
In message 20210701061611.957918-3-seanga2@gmail.com you wrote:
This is the LIL programming language [1] as originally written by Kostas Michalopoulos badsector@runtimeterror.com. LIL is a stripped-down TCL variant. Many syntax features are very similar to shell:
Do you have a list of the exact differencec between LIL and a standard shell?
For a partial list, see
Whoops, looks like I completely misread what you were asking here. I don't have an exhaustive list of differences, but here are some similar things expressed in both languages:
sh tcl
foo=bar set foo bar echo $foo echo $foo
if [ 1 -gt 2 ]; then if {1 > 2} { echo a echo a else } { echo b echo b fi }
foo() { proc foo {first second} { echo $1 $2 echo $first $second } }
for file in $(ls *.c); do foreach file [glob *.c] { echo $file echo $file done }
fact() { if [ $1 -eq 0 ]; then echo 1 else echo $(($1 * $(fact $(($1 - 1))))) fi }
proc fact {n} { if {$n} { expr {$n * [fact [expr {$n - 1}]]} } { return 1 } }
Hopefully this gives you a bit of a feel for the basic differences.
--Sean
I wonder, if we deviate from standard shell syntax anyway, we could also have a look at lua, for example?
I also looked at lua (see the cover letter), but I rejected it based on size constraints (eLua was around the size of U-Boot itself).
Because of how often the shell is used to debug things, I wanted the candidate I picked to have similar syntax to the existing shell. For example,
load mmc ${mmcdev}:${mmcpart} $loadaddr $image
is a valid command in both Hush and LIL. Compare with lua, which might express the above as
load("mmc", mmcdev .. ":" .. mmcpart, loadaddr, image)
which I think is a much larger deviation from existing syntax.
--Sean