[POLL] Compiler for DM15L ?

Forum for discussion of the DM10, DM11, DM12, DM15, DM16 and DM41 units

Which programming language would you prefer?

Something else (see comments)
None, the native assembly-like language is fine
Total votes: 23

Posts: 488
Joined: Wed May 03, 2017 5:46 pm
Location: Malone, NY USA

Re: [POLL] Compiler for DM15L ?

Post by toml_12953 » Thu Apr 18, 2019 4:39 pm

michaelzinn wrote:
Fri Apr 12, 2019 12:16 pm
toml_12953 wrote:
Fri Apr 12, 2019 12:04 am
e12g wrote:
Wed Apr 10, 2019 5:33 pm
Python makes sense. The language has a large user base and is growing in popularity.
I'd want a FULL Python, though. Not one of these "MicroPython" implementations.
How would a full Python with Strings and all be usable on the DM15L? I'd probably not do an exact implementation of a language anyway, e.g. I'd use the native decimal numbers of the calculator instead of integers or IEEE floats.

It's interesting that Python is so popular. The syntax is not that easy to parse...
It's fine to do another language but please don't call it Python unless it really is. One of the main reasons for higher level languages is portability and programmers should be confident that a program written in Python will be able to run on any system that supports Python with minimal changes. Internal differences such as numerical format don't matter too much to a high level programmer as long as the answers are consistent.
Tom L


DM42 SN: 00025 (Beta)
SN: 00221 (Shipping)

Posts: 52
Joined: Tue May 02, 2017 8:11 am
Location: Australia

Re: [POLL] Compiler for DM15L ?

Post by pauli » Tue Apr 23, 2019 1:44 pm

If possible, I'd go for Lua -- small and lean VM, JIT compilation is available for ARM CPUs and it is fast (even without that).
It's also a very simple but expressive language.


Posts: 17
Joined: Tue Apr 10, 2018 9:34 pm

Re: [POLL] Compiler for DM15L ?

Post by michaelzinn » Wed Apr 24, 2019 12:45 pm

pauli wrote:
Tue Apr 23, 2019 1:44 pm
[...] JIT compilation is available for ARM CPUs [...]
Interesting, thank you for pointing that out! But that's not the goal here: I'd like to compile to the language of the calculator (is it called RPN?), not create an alternative firmware where you can run Lua on the exposed ARM CPU. If you want serious programming on a handheld device I think programming a smartphone app is a much more sensible approach.

My goal is to get a basic understanding of programming languages and compilers, and given that I already wrote some complex programs in RPN (interpreter, binary converter with lookup tables...) I think that I have a good enough understanding of the language to use it as a compiler target. In addition, it would be nice if it were also useful for other people (unlike the BF interpreted), hence this thread.

Also, the current status is that I now understand parser combinators and implemented them in Idris. I should be able to parse any language now, but I think old style BASIC with line numbers and gotos should be the choice with the best usefulness to difficulty quotient, given that I wouldn't need to think about complicated things like variable scopes and stack frames.

Posts: 17
Joined: Tue Apr 10, 2018 9:34 pm

Re: [POLL] Compiler for DM15L ?

Post by michaelzinn » Tue May 14, 2019 10:57 am

I decided to go with CommodoreBASIC (C64), for these reasons:
- It is easier to compile than most other languages (only global variables, no stack frames etc.)
- It is something that people who use HP calculators might know, because it is from the same time
- You can compile old number based BASIC games and play them on your calculator, e.g. Hammurabi

I'll start with a useful subset, i.e. I want to be able to compile the Hammurabi game and run it on my calculator: http://vintage-basic.net/bcg/hammurabi.bas

The Hammurabi game uses 15 variables and 26 jump targets, so as a first version I'll compile variables to directly accessible registers (0-19) but jumps to line numbers instead of labels. More sophisticated features like functions or lists will come later when/if I need them or somebody asks for them.

Current state of the project is that it parses the whole program and compiles some expressions (ENTER insertion was tricky):

Code: Select all


Do you have an idea for a name for this compiler? Maybe VoyagerBASIC or voyagerc?
Last edited by michaelzinn on Tue May 14, 2019 11:28 am, edited 1 time in total.

Posts: 17
Joined: Tue Apr 10, 2018 9:34 pm

Re: [POLL] Compiler for DM15L ?

Post by michaelzinn » Mon May 20, 2019 2:21 pm

Compiling works now, but only for programs smaller than 448 lines because of viewtopic.php?f=11&t=2186.

I'll see if I can clean up the code and release it in the next days/weeks/when I have time.

Post Reply