Languages for standalone

Programming, for all ages and all languages.
User avatar
eekee
Member
Member
Posts: 827
Joined: Mon May 22, 2017 5:56 am
Freenode IRC: eekee
Location: Hyperspace
Contact:

Re: Languages for standalone

Post by eekee »

It is fun! You're welcome. :D
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
SamDengmar
Posts: 1
Joined: Thu Oct 29, 2020 12:59 pm

Re: Languages for standalone

Post by SamDengmar »

C language doesn't need anything. All of its run-time is pushed into library functions. :^o :^o
User avatar
Thomas
Member
Member
Posts: 281
Joined: Thu Jun 04, 2009 11:12 pm

Re: Languages for standalone

Post by Thomas »

Hi,
Oberon
I presented this in college while doing a compiler project.

http://www.projectoberon.net/wirth/Proj ... System.pdf
http://blog.gadgetfactory.net/2016/02/h ... dern-fpga/

--Thomas
User avatar
eekee
Member
Member
Posts: 827
Joined: Mon May 22, 2017 5:56 am
Freenode IRC: eekee
Location: Hyperspace
Contact:

Re: Languages for standalone

Post by eekee »

@Thomas: Nice! Am I making too big a leap in assuming this RISC processor is related to RISC-V?
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
User avatar
Thomas
Member
Member
Posts: 281
Joined: Thu Jun 04, 2009 11:12 pm

Re: Languages for standalone

Post by Thomas »

Hi eekee,

http://www.projectoberon.com/

The oberon language is not tied to any implementation. Yes, the processor implemented on FPGA is based on Risc5. Dr Wirth designed pascal. It is no surprise than oberon has a pascal flavor.
--Thomas
PeterX
Member
Member
Posts: 590
Joined: Fri Nov 22, 2019 5:46 am

Re: Languages for standalone

Post by PeterX »

eekee wrote:@Thomas: Nice! Am I making too big a leap in assuming this RISC processor is related to RISC-V?

Professor Wirth's Risc CPUs are not related to Risc-V.

Greetings
Peter
User avatar
Thomas
Member
Member
Posts: 281
Joined: Thu Jun 04, 2009 11:12 pm

Re: Languages for standalone

Post by Thomas »

The module is named RISC5. I did not dig deep to see if the implementation is actually based on RISCV. Sorry!. During my college years, there was only the native Oberon which ran on bare x86 hardware.
--Thomas
User avatar
eekee
Member
Member
Posts: 827
Joined: Mon May 22, 2017 5:56 am
Freenode IRC: eekee
Location: Hyperspace
Contact:

Re: Languages for standalone

Post by eekee »

Thanks guys.

I'm thinking I might write up a wiki page for Plain English Programming, but I'm awfully tired these days. Maybe when my meds are sorted.

SamDengmar wrote:C language doesn't need anything. All of its run-time is pushed into library functions. :^o :^o

This is almost but not literally true. C has a very small runtime; look up crt0. "crt" in fact stands for "C run-time".
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
User avatar
eekee
Member
Member
Posts: 827
Joined: Mon May 22, 2017 5:56 am
Freenode IRC: eekee
Location: Hyperspace
Contact:

Re: Languages for standalone

Post by eekee »

bloodline wrote:
eekee wrote:You know, I don't think Plain English Programming has much runtime. The package you get includes just 5 files of source, and that's sufficient to rebuild itself. To build other programs with it, you only need to include one of those files. In other words, the entire language runtime is in one file.

https://osmosianplainenglishprogramming.blog/


Goodness! This looks like a fun language, I’ve never heard of it before, thanks for sharing. I’ll have fun reading about this language later :D

I was in the mood to waste time today.
https://wiki.osdev.org/Plain_English_Programming :mrgreen:
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
User avatar
bzt
Member
Member
Posts: 1584
Joined: Thu Oct 13, 2016 4:55 pm
Contact:

Re: Languages for standalone

Post by bzt »

eekee wrote:
SamDengmar wrote:C language doesn't need anything. All of its run-time is pushed into library functions. :^o :^o
This is almost but not literally true. C has a very small runtime; look up crt0. "crt" in fact stands for "C run-time".
...which is not used in freestanding mode. :-) It's perfectly valid not having "main()" in a C source and implement directly "_start()" instead (conventionally the executable's entry point is "_start", provided by the crt0 in hosted environment, which in turn calls "main").

Cheers,
bzt
User avatar
eekee
Member
Member
Posts: 827
Joined: Mon May 22, 2017 5:56 am
Freenode IRC: eekee
Location: Hyperspace
Contact:

Re: Languages for standalone

Post by eekee »

So how do you set up the stack, then? :) That's one of crt0's jobs.
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
nexos
Member
Member
Posts: 1071
Joined: Tue Feb 18, 2020 3:29 pm
Freenode IRC: nexos

Re: Languages for standalone

Post by nexos »

eekee wrote:So how do you set up the stack, then? :) That's one of crt0's jobs.

The program loader should set up a stack. crt0 would not allocate the stack, as crt0 needs a stack itself :) .
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
User avatar
eekee
Member
Member
Posts: 827
Joined: Mon May 22, 2017 5:56 am
Freenode IRC: eekee
Location: Hyperspace
Contact:

Re: Languages for standalone

Post by eekee »

Y'all are making me think! :P

Why would crt0 specifically need a stack when it's typically written in assembly language? It's fine for the program loader to provide one, but a bit of searching earlier indicated there are architectures where crt0 has to set up the stack.
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Languages for standalone

Post by Solar »

A freestanding platform might not have a program loader. Your program might be sitting on a ROM, with the CPU starting at a hard-coded address on power-up. BIOS, Kickstart, you name it.) Your platform might not have a stack. I don't know what other architecture it could have, but there is no mention of "stack" in the language standard; it's up to the implementation how it handles automatic variables and returning from functions. If you're thinking about what could be, don't get hung up on what "usually" is...
Every good solution is obvious once you've found it.
nexos
Member
Member
Posts: 1071
Joined: Tue Feb 18, 2020 3:29 pm
Freenode IRC: nexos

Re: Languages for standalone

Post by nexos »

bzt was talking about in the case of a loaded program on say Linux. Although an insane kernel may not set up a stack, most kernels do set one up automatically. Systems without a stack will use something else in place. I'm thinking of x86 :) . As for BIOS ROM code, that's sort of different, as generally there called from the CPU. I was talking about the situation bzt was talking about. Also, crt0 doesn't need to set up a stack, because as Solar said, the C spec doesn't mention a stack in it.
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
Post Reply