Join us on Discord!
You can help CodeWalrus stay online by donating here.

[HP Prime/PC] Source - It's a programming language.

Started by iconmaster, January 21, 2015, 10:24:59 PM

Previous topic - Next topic

0 Members and 4 Guests are viewing this topic.

iconmaster

Once upon a time, I was writing programs for the HP Prime in HPPL. The more I worked in HPPL, the more I became dissatisfied with the language. I mean, it was usable, but I wanted better.

So I decided to make something better. I started work on Source. It's a programming language.

Source is a procedural, statically-typed bytecode-compiled language that can either compile to whatever platform you need or interpret directly on your computer. Currently, it compiles to HPPL.

Source gives you control. It's statically typed, so you can read your code more easily. It can assume types, so it's not needlessly verbose. You can control how it compiles through directives.

Source is flexible. It provides data structures and user types. You can define methods for data types anywhere. You can organise your code into packages. Source even can handle cyclic dependencies!

Source has tools. Compile it into HPPL from the command line, or use SourceBench to write and compile code on the fly. Use SourceBox to run your code on your PC. Run SourceLine to interactively execute Source code.

Source isn't done yet. The core libraries still need implemented, not to mention a bunch of features such as custom structs and classes. In the future, it will be able to compile to a bunch of places, not just HPPL. I wouldn't describe it as 'usable' yet. But stay tuned!

Anyways, the important bit: The link. Check out the source code at:

https://github.com/iconmaster5326/Source

Want to download Source? Want to learn more? Check out the wiki at:

https://github.com/iconmaster5326/Source/wiki

The wiki has downloads, documentation, and tutorials.

Dream of Omnimaga

This is definitively something I'll need to try to learn when I am done with Supersonic Ball HP and Super Walrii Land. :) I'm also glad that you are still planning PC support. It would be nice to be able to make games for both calcs and the computer simultaneously. Maybe eventually you could also compile to Ndless C?
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

iconmaster

I'm creating tutorials for those who want to get up to date on the syntax of Source on the wiki here. I suggest you check it out!

Quote from: DJ Omnimaga on January 22, 2015, 04:05:00 AM
I'm also glad that you are still planning PC support. It would be nice to be able to make games for both calcs and the computer simultaneously. Maybe eventually you could also compile to Ndless C?

If LLVM can be compiled to ARM assembly, I'd assume you could get something working on the NSpire in short order. It'd take some work, though, but its quite possible.

Dream of Omnimaga

Cool to hear about the tutorials. In the past, some people made new languages for various calculators, but they would remain undocumented for the most part, which prevented many people from using them.

And thanks for the info about LLVM.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Dream of Omnimaga

  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

iconmaster

Quote from: DJ Omnimaga on March 11, 2015, 11:03:27 AM
Btw have you worked on this recently?

In the past few weeks, I've done some minor changes to the compiler, yes. Mostly, though, I've had to take time to deal with other obligations.

When I have time, I need to rewrite the HPPL output platform, so expect large changes when they do happen...

Dream of Omnimaga

Aah ok no problem. Glad this is still worked on :). Keep us updated when there are big updates :)
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

alexgt

Wow when I get my prime I will definitly use this!
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

Yuki

Yep, shoulda try it out. By the way, is there any way to use it with LLVM (since you mentioned it in the thread)?
  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)
  • Consoles, mobile devices and vintage computers owned: A lot
Read Zarmina!
YUKI-CHAAAANNNN
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron

if you wanna throw money at me and/or CodeWalrus monthly it's here

Duke "Tape" Eiyeron

Making llvm work on calc would be rad as it'd open so much things for the calc. Each langugae that would compile into LLVM could be run on the Nspire. Imagine the feats one could do!
  • Calculators owned: A lot.

Snektron

isnt there already a LLVM to Z80 compiler? also i did a click google on it some time ago and i saw some Cemetech posts about it
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


iconmaster

Hello, everyone! Glad you've been interested in Source. I updated the OP, so now it describes Source a little better.

Quote from: Juju on March 25, 2015, 05:20:07 AM
Yep, shoulda try it out. By the way, is there any way to use it with LLVM (since you mentioned it in the thread)?

There WILL be a way to, but the LLVM platform for Source is not usable yet. In time, I hope LLVM to be the primary compilation target for Source.

Quote from: Cumred_Snektron on March 25, 2015, 11:10:36 AM
isnt there already a LLVM to Z80 compiler? also i did a click google on it some time ago and i saw some Cemetech posts about it

There is the one LLVM Z80 project I know of, but it hasn't been worked on for several years, apparently. It doesn't look working yet, but I have hopes.

Right now, I discovered some mechanics in the core Source engine that need rewritten, so I'm seriously considering rewriting the Source compiler from scratch. If I do this, it might be a while before Source becomes usable. It would be for the better, however; my old code can be a bit hard to follow.

Snektron

#12
Wait- this is a language on a virtual machine? wouldn't it be possible to port it to other calculators and make a common programming language? O.O
i've always wanted to code a higher virtual machine than my brainc compiler... though i don't have mcuh experience and don't really get some of the opcodes...
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


iconmaster

Quote from: Cumred_Snektron on March 26, 2015, 08:27:19 PM
Wait- this is a language on a virtual machine? wouldn't it be possible to port it to other calculators and make a common programming language? O.O
i've always wanted to code a higher virtual machine than my brainbleep compiler... though i don't have mcuh experience and don't really get some of the opcodes...

The name of LLVM is a misnomer. It is not a virtual machine; is compiles code using LLVM IR, a virtual language, as an intermediate. When Source compiles to LLVM, it will be a fully compiled language.

In other news, I'm finalizing pointer operations in Source. What syntax looks better to you guys?

one() is a function that returns a pointer to a local. two() returns the value inside that pointer, dereferencing it.


//idea 1
function one() as ptr[int] {
local a = 2
return a.ptr
}

function two(b as ptr[int]) as int {
return b.value
}



//idea 2
function one() as $[int] {
local a = 2
return $a
}

function two(b as $[int]) as int {
return b$
}

Snektron

Yes but since there's not really a good z80 backend a seperate compiler/virtual machine for z80 would still be cool :)
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Powered by EzPortal