rje Posted November 11, 2020 Share Posted November 11, 2020 (edited) Take Python, and shake it down to the X16's hardware. We'd probably lose space-awareness in exchange for block delimiters and statement terminators (no, really) -- call it syntactic sugar in exchange for less parsing code, and probably less memory. Naturally, we'd lose most or all of our regular expressions and all the other powerful things that make Python modern. Lambdas gone. Multiline comments gone too (not because it's hard, but because every little bit helps, and we can sacrifice some things to keep others, such as slices). Dictionaries are gone. And of course, no importing libraries. Other things would end up on the chopping block -- in short, if you want to keep Favorite Feature X, you'll have to sacrifice Features Y+ to get it. But we WOULD still need the REPL, and in fact, the REPL would have to be expanded to be more of a regular execution environment: in a word, a SHELL, with a management layer built on top of the KERNAL. In short, we'd be left with a 3GL that, except perhaps for visible features, differs little from some 3GLs of the early 70s with some Pythonic syntax. This feature set is: * "untyped" variables (or, more appropriately termed, "multi-type" variables). * tuples, and maybe slices. * typical control structures (if, while). * comparison, arithmetic, logical, and bitwise operators of course. * list comprehensions (foreach). * typical built-in functions (len). * print * # comment * nested control blocks, to some degree (depending on how we do the stack). Plus something 3GLs of the 70s didn't have: * an execution shell (the REPL might have to be grown in some ways, and shrunk in others). Now take Perl, and do the same thing. Gone are hashtables, regexes, curly braces. Gone is CPAN. Gone are first-class functions. Gone are most of the sed- and AWK-like features. And so on. And its debugging runtime would have to be expanded into a full execution environment: in a word, a SHELL, with a management layer built on top of the KERNAL. In short, we'd be left with a 3GL that, except perhaps for visible features, differs little from some 3GLs of the early 70s with some Perlish syntax. This feature set is: * "untyped" variables (or, more appropriately termed, "multi-type" variables). * arrays, and maybe slices. * typical control structures (if, while). * comparison, arithmetic, logical, and bitwise operators of course. * list comprehensions (foreach). * typical built-in functions (len). * print * # comment * nested control blocks, to some degree (depending on how we do the stack). Plus something 3GLs of the 70s didn't have: * an execution shell (the debugger might have to be grown in some ways, and shrunk in others). Do the same thing with Groovy, or Ruby, and you get the same results (Yeah yeah, I know, Groovy and Ruby and Perl are more similar than different. Sue me.) Look familiar? The more I squint, the more this resembles a minimal shell. C shell, in particular, for its tradeoff of relative power and simplicity. Call it "CSH minus minus". Alex Johnson, an online nerd friend, stated this obvious fact to me yesterday, and I immediately realized he was right. Edited November 11, 2020 by rje Quote Link to comment Share on other sites More sharing options...
mrdoornbos Posted November 11, 2020 Share Posted November 11, 2020 I've been a longtime professional Python and Ruby programmer... I'm not sure I would want a crippled version of either of those. What probably makes a lot of sense is a very enhanced BASIC. I know I go on and on about it on forums, but the BASIC in the Maximite is very powerful and manages a lot of modern concepts without being a crippled version of something else. 2 Quote Link to comment Share on other sites More sharing options...
rje Posted November 11, 2020 Author Share Posted November 11, 2020 (edited) Structured BASIC is a bit different feature set, but yes it's a welcome addition, and I think it is planned for the X16. A shell, on the other hand, would also be a powerful "language" to have. Anyway, code solves arguments, so I'll see what we can do. Edited November 11, 2020 by rje Quote Link to comment Share on other sites More sharing options...
mrdoornbos Posted November 11, 2020 Share Posted November 11, 2020 Structured BASIC is a bit different feature set, but yes it's a welcome addition, and I think it is planned for the X16. A shell, on the other hand, would also be a powerful "language" to have. Anyway, code solves arguments, so I'll see what we can do. Yeah, be a cool thing to try to do. Didn’t mean to imply that experiments aren’t interesting! Quote Link to comment Share on other sites More sharing options...
rje Posted November 11, 2020 Author Share Posted November 11, 2020 Sure. And I get it -- I mean on the FB forum I think I see a new posting for some sort of "X16 Python" every few months. Frankly, once I factored in the hardware limitations, I was supposing that "Python", "Perl", "Java", and their brethren would more or less boil down to variants of Structured BASIC. I mean that's oversimplifying, but the problem is that X16 hardware requires *drastic* simplification. The fun part is that X16 hardware can probably run things that computers could run in the early 70s, so there are still possibilities. Quote Link to comment Share on other sites More sharing options...
Fnord42 Posted November 11, 2020 Share Posted November 11, 2020 I imagine Lua might be better suited for the hardware than Python or Ruby. Quote Link to comment Share on other sites More sharing options...
Fnord42 Posted November 11, 2020 Share Posted November 11, 2020 There's Lua for AVR Microcontrollers: https://github.com/deemess/uLua Quote Link to comment Share on other sites More sharing options...
rje Posted November 11, 2020 Author Share Posted November 11, 2020 My first forays is a very useless shell. It does exactly five things: 1. prints a welcome message 2. prints a prompt (%) 3. has a REPL that usually does nothing 4. will print out the contents of the X16's R1,R2,R3, and R4 registers in response to "REG". 5. will exit in response to "EXIT". Hooray. It's also got quite a bit of debugging code. ...You know, I really don't like that CC65's code can't be re-run after terminating. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.