
Partcl – a tiny command language - vmorgulis
http://zserge.com/blog/tcl-interpreter.html
======
boznz
I don't know TCL at all though I have implemented my own variation of tiny C
in a handheld terminal I designed in the past which fitted nicely in 10KB in a
PIC18F processor and 3K of RAM for the (compressed) basic so always good to
see a different spin on other interpreters.

Your code doesn't actually compile in my MPLAB XC8 compiler but should be
fixable so I may give it a go. I note there are no comments in the code but
the explanation text should help.

~~~
chocolatebunny
That actually sounds really impressive. What did you gain from having a C
compiler on an PIC? Was it used as your commandline interpreter?

~~~
boznz
whoops.. Would have been impressive if it wasn't a typo, should have read
"tiny basic"

~~~
ejanus
Was it assembly or c Lang?

------
david-given
See also TH1, which is the Tcl subset which Fossil uses for HTML templating:

[http://fossil.wanderinghorse.net/repos/th1-sgb/index.cgi/wik...](http://fossil.wanderinghorse.net/repos/th1-sgb/index.cgi/wiki/th1-sgb)

It's about 6kloc. (I don't know how it compares to Picocl feature-wise.)

------
davidw
I made my own tiny Tcl thing a while back:

[https://github.com/davidw/hecl](https://github.com/davidw/hecl)

It ran on those Nokia phones that had a minimal version of Java (no floats!),
which was kind of cool back in the day.

~~~
ejanus
Is Hecl a tiny Tcl or a script language that borrowed a lot from Tcl? I
checked your codebase it looks clean and easy to follow though my Java is
rusty. I noticed you used 'instanceof' a lot, why not something like Visitor
pattern ? You have not updated it for over 6 years , why? What is your future
plan, and are you really look for contributors ?

------
ethanpil
TCL is an interesting idea. I have been a fan of MicroPython
([https://micropython.org/](https://micropython.org/)) for a while. It's
probably not as tight or efficient as Partcl but I think it may be a good
contender for a comparison in your original article.

~~~
matt_trentini
I was about to suggest the same; Micropython requires a little more flash/RAM
([https://github.com/micropython/micropython/wiki/FAQ](https://github.com/micropython/micropython/wiki/FAQ))
than the authors goals but it's certainly no toy language despite the immature
(but rapidly improving) tooling and libraries. I'm pushing to use it in more
of my embedded projects - and have little desire to return to embedded C!

------
__michaelg
Nice project!

Unfortunately, as with most interpreters written in C, _afl_ finds segfaulting
bugs in a few seconds. In your case at least empty variable substitutions are
broken. E.g., entering

    
    
      $ foo
    

will crash.

------
gravypod
I don't see why one would choose TCL over LISP-likes which can be made equally
as efficient and are very simple to implement and optimize.

~~~
kevin_thibedeau
(((((I can't either))))))

~~~
vanderZwan
I was seriously confused by your message for a second:

[https://en.wikipedia.org/wiki/Triple_parentheses](https://en.wikipedia.org/wiki/Triple_parentheses)

