• Source: It's a programming language. Now with HPPL support! 5 1
Currently:  

Author Topic: Source: It's a programming language. Now with HPPL support!  (Read 39432 times)

0 Members and 1 Guest are viewing this topic.

Offline iconmaster

  • LV3 Member (Next: 100)
  • ***
  • Posts: 82
  • Rating: +5/-0
    • View Profile
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.
« Last Edit: March 28, 2015, 03:12:20 pm by iconmaster »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: HPP+ : A WIP alternate programming language for the Prime
« Reply #1 on: June 25, 2014, 07:18:14 pm »
Seems interesting. Since HP PPL is fast I think an alternate language that compiles to it could be very feasible, although an interpreted language would probably run as slow as 83+ BASIC or so. Just make sure, however, that the compiled code doesn't end up totally bloated or unoptimized, though.

One thing I would suggest is offering certain pre-made routines for sprites or maps, for example, with a decompressor, so that people could use different image formats that are smaller than the built-in ones. The resulting code would simply decompress the images into a GROB upon runtime.

Offline iconmaster

  • LV3 Member (Next: 100)
  • ***
  • Posts: 82
  • Rating: +5/-0
    • View Profile
Re: HPP+ : A WIP alternate programming language for the Prime
« Reply #2 on: June 26, 2014, 08:43:22 am »
Seems interesting. Since HP PPL is fast I think an alternate language that compiles to it could be very feasible, although an interpreted language would probably run as slow as 83+ BASIC or so. Just make sure, however, that the compiled code doesn't end up totally bloated or unoptimized, though.
Yeah, an interpreted language isn't a good idea for speed here. Even if I made, like, a bytecode language, it wouldn't be fast.

And yes, optimization will be important. I'll have to do lots of testing to see what code patterns run the most efficiently.

One thing I would suggest is offering certain pre-made routines for sprites or maps, for example, with a decompressor, so that people could use different image formats that are smaller than the built-in ones. The resulting code would simply decompress the images into a GROB upon runtime.

I do plan on having all-new custom functions in the mix as well, yes. Graphics-wise, I'll see if there's a format that's smaller than ICON (Uncompressed PNG file? There has to be a better way). The compiler will be smart enough to only put HPP+ custom functions into the code if you call them.

For example, there's no simple function to get only a part of a list, or to insert a list item in the middle of one. HPP+ will add these functions, which will decompile into an HPPL function that gets called when needed.


In the future, I'll probably be collaborating with other interested people to figure out A. how to organise functions into packages and B. what custom function we need and how they should be called.
« Last Edit: June 26, 2014, 08:45:18 am by iconmaster »

Offline bb010g

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 428
  • Rating: +22/-1
  • I do stuff
    • View Profile
    • elsewhere on the net
Re: HPP+ : A WIP alternate programming language for the Prime
« Reply #3 on: June 26, 2014, 04:27:25 pm »
I like the idea, but I think this will become less useful over time. The most important thing the Prime needs is some way of passing around functions (either anonymously or by pointers) and values (pointers most likely) without strings. I used expr in a paint program I had and it dropped performance a bunch. Every time an expr is hit, a bit of compilation has to be done. In a tight loop (like in a game), this gets bad fast. I like the constants, but it's more space in the editor on-calc. I wouldn't mind so much if it was just in the compiled file. These problems can only be fixed by changing PPL itself. I think adding pointers, even without pointer arithmetic, development would be a whole lot nicer. (I would also feel better about using large data structures. :)) I'm using struct-esque lists in my in-progress Tetris clone, and all you really need are program-local vars that act like enums and a function to take key-value pairs and give a list with the proper indices. That function could even just be shared in a lib.

Anyhow, I'm looking forward to see how this goes. :)
Arch Linux user
Haskell newbie | Warming up to Lua | Being dragged into C++
Calculators: HP 50g, HP 35s, Casio Prizm, TI-Nspire CX CAS, HP 28s, HP Prime, Mathematica 9 (if that counts)
π: 3.14...; l: 108; i: 105; e: 101; l+i+e: 314
THE CAKE IS A LIE IS A PIE

Offline cyrille

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 8
  • Rating: +0/-0
    • View Profile
Re: HPP+ : A WIP alternate programming language for the Prime
« Reply #4 on: June 27, 2014, 01:26:46 am »
Hello,

>smaller than ICON (Uncompressed PNG file? There has to be a better way).
ICON is a compressed PNG... problem is that since it is in hex, it takes 2 bytes per nibble :-(


>For example, there's no simple function to get only a part of a list
yes there is! L1({5,8}) will get you elements 5 to 8 of L1 in a list..

>or to insert a list item in the middle of one.
concat(L1({1,n}), { 1, 2, 3}, L1({n,1000}))

You can also pass around functions, but they need to be properly QUOTEd to make sure that they are not evaluated at the wrong time...

Cyrille

Offline iconmaster

  • LV3 Member (Next: 100)
  • ***
  • Posts: 82
  • Rating: +5/-0
    • View Profile
Re: HPP+ : A WIP alternate programming language for the Prime
« Reply #5 on: June 27, 2014, 08:08:42 am »

Hey Cyrille!

Hello,

>smaller than ICON (Uncompressed PNG file? There has to be a better way).
ICON is a compressed PNG... problem is that since it is in hex, it takes 2 bytes per nibble :-(
I can see what you had to do it that way, though. Translating bytes directly into unicode would mean there would be characters like ; or control chars in the ICON. Perhaps if you encode it into base64?

>For example, there's no simple function to get only a part of a list
yes there is! L1({5,8}) will get you elements 5 to 8 of L1 in a list..

>or to insert a list item in the middle of one.
concat(L1({1,n}), { 1, 2, 3}, L1({n,1000}))
What.

You can also pass around functions, but they need to be properly QUOTEd to make sure that they are not evaluated at the wrong time...

Cyrille
WHAT.

Well, knowing this, back to messing around with quotes...


EDIT: Today, I learned that a list can have a maximum of 2^31 entries! You learn something new every day.
« Last Edit: June 27, 2014, 08:27:47 am by iconmaster »

Offline bb010g

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 428
  • Rating: +22/-1
  • I do stuff
    • View Profile
    • elsewhere on the net
Re: HPP+ : A WIP alternate programming language for the Prime
« Reply #6 on: July 03, 2014, 01:51:22 am »
You can also pass around functions, but they need to be properly QUOTEd to make sure that they are not evaluated at the wrong time...
Could you give an example?
Arch Linux user
Haskell newbie | Warming up to Lua | Being dragged into C++
Calculators: HP 50g, HP 35s, Casio Prizm, TI-Nspire CX CAS, HP 28s, HP Prime, Mathematica 9 (if that counts)
π: 3.14...; l: 108; i: 105; e: 101; l+i+e: 314
THE CAKE IS A LIE IS A PIE

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: HPP+ : A WIP alternate programming language for the Prime
« Reply #7 on: July 03, 2014, 01:58:51 am »
EDIT: Today, I learned that a list can have a maximum of 2^31 entries! You learn something new every day.
YEah I think the limit was increased in the 2nd firmware. Beforehand I think the limits from the HP 39gII were all accidentally left in, including DIMGROB size limits and stuff. IIRC the max amount of elements in lists was 999 like on the TI-83 Plus.

Offline iconmaster

  • LV3 Member (Next: 100)
  • ***
  • Posts: 82
  • Rating: +5/-0
    • View Profile
Re: HPP+ : A WIP alternate programming language for the Prime
« Reply #8 on: October 06, 2014, 04:23:56 pm »
So you guys may be surprised to learn that this project isn't dead. Actually, I've restarted from scratch.

Today, I'm introducing Source.

Source is the new name for HPP+. I made the change because I might (might!) make this language compilable to other places eventually.

There is currently the Source compiler, which parses Source programs but doesn't compile it yet, and a Source plugin for the IDE Netbeans. The plugin has syntax highlighting and error displaying already built in.


Take a look at https://github.com/iconmaster5326/Source .

Soon, I plan on giving you guys a WIP document on the exact syntax of Source. Also, I really need to update the OP.

One las thing, concerning pointers: I've worked with QUOTE a little (I need to show you guys how it works), but it acts quite... Uniquely. I may or may not be able to figure out how to use this to make pointers fast.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: HPP+ : A WIP alternate programming language for the Prime
« Reply #9 on: October 06, 2014, 07:50:36 pm »
Hi and nice to see you again. :D

As for the new name, just keep in mind it might confuse people if they post actual source code literally :P, but I like the idea. Btw do you plan to write a tutorial on how to code in Source when finished? It might be good to post about it here if that's the case, so more people see it.

btw is this still a language written in HP PPL or does it now use ASM/C through any HP Prime exploit?

Offline iconmaster

  • LV3 Member (Next: 100)
  • ***
  • Posts: 82
  • Rating: +5/-0
    • View Profile
Re: <UPDATED> Source: A WIP alternate programming language for the Prime
« Reply #10 on: October 06, 2014, 07:55:02 pm »
Hi and nice to see you again. :D

Hey! I just updated the OP, funny thing.

As for the new name, just keep in mind it might confuse people if they post actual source code literally :P , but I like the idea. Btw do you plan to write a tutorial on how to code in Source when finished? It might be good to post about it here if that's the case, so more people see it.

Source is a good name. I don't see how it could be confusing. :P


Anyways, I plan on writing Source tutorials soonish. Probably before the whole project is done, actually! Sooner than later, though, will be coming a description of the syntax. Syntax is important! How else can I get feedback on this thing?

btw is this still a language written in HP PPL or does it now use ASM/C through any HP Prime exploit?

Sadly, I have not found any good haxx. :P It will be initially entirely compiled to HPPL. However, as we learn more about the OS, I am willing to add in features in ASM/C.


Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: <UPDATED> Source: A WIP alternate programming language for the Prime
« Reply #11 on: October 06, 2014, 07:59:39 pm »
Indeed. I am really curious about how this language will look like. Just make sure it's not overly cryptic like Antidisassemblage on the 84+. Ironically, that language was meant to bridge the gap between TI-BASIC and Z80 ASM, yet it required learning ASM in order to even understand why Squirrelbox works in certain ways, which defeated the entire point.

Offline JWinslow23

  • Coder Of Tomorrow
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 556
  • Rating: +43/-6
  • I make quality calculator games...when I have time
    • View Profile
Re: <UPDATED> Source: A WIP alternate programming language for the Prime
« Reply #12 on: October 06, 2014, 08:26:18 pm »
Indeed. I am really curious about how this language will look like. Just make sure it's not overly cryptic like Antidisassemblage on the 84+. Ironically, that language was meant to bridge the gap between TI-BASIC and Z80 ASM, yet it required learning ASM in order to even understand why Squirrelbox works in certain ways, which defeated the entire point.
The only invented languages I know of that were successful are Axe and Nspire C++. I hope this will add another one to the list. :)
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
Click here for the only set of games you'll ever need
= ?

Offline iconmaster

  • LV3 Member (Next: 100)
  • ***
  • Posts: 82
  • Rating: +5/-0
    • View Profile
Re: <UPDATED> Source: A WIP alternate programming language for the Prime
« Reply #13 on: October 06, 2014, 08:55:49 pm »
Indeed. I am really curious about how this language will look like. Just make sure it's not overly cryptic like Antidisassemblage on the 84+. Ironically, that language was meant to bridge the gap between TI-BASIC and Z80 ASM, yet it required learning ASM in order to even understand why Squirrelbox works in certain ways, which defeated the entire point.

Well, guess what? I quickly wrote up some syntax. It's at https://github.com/iconmaster5326/Source/blob/master/SyntaxGuide.src ! Try downloading the NetBeans plugin to read it in full color.

No, I'm not done with said syntax sheet yet. It's very bare-bones ATM.

The only invented languages I know of that were successful are Axe and Nspire C++. I hope this will add another one to the list. :)

Well, thank you. I'll do my best.


EDIT: Well, it seems pointers are on the table.


Code: [Select]
FUNC(a)
BEGIN
 MSGBOX("call "+a);
END;


FUNC2()
BEGIN
 LOCAL AA=1;
 LOCAL BB='FUNC(AA)';
 EVAL(BB);
 AA:=2;
 EVAL(BB);
 AA:=3;
 RETURN BB;
END;


EXPORT TST2()
BEGIN
 LOCAL XX=FUNC2();
 LOCAL AA=4;
 EVAL(XX);
END;

« Last Edit: October 06, 2014, 09:14:20 pm by iconmaster »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: <UPDATED> Source: A WIP alternate programming language for the Prime
« Reply #14 on: October 06, 2014, 10:47:03 pm »
Ok thanks I'll check that out when I have a minute. :)