ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've been considering something a lot. Is my language that I've been working on, PNFHA, really a high-level language, or is it more like a mid-level language upon which a true high-level language should be built? I can give examples, if needed. But what I find, is that the best practice so far when coding in it, is to think a bit about both what is happening in your code, and what's going on a the level below it (PNFASM).
I find [...] that the best practice [...] when coding in it, is to think a bit about both what is happening in your code, and what's going on a the level below it (PNFASM).
But, isn't that always the case?
In my vernacular (which ordinarily doesn't spend too much time thinking about such things ...), a "low-level" language would be "assembler," and a "mid-level" language might be something that is really intended only to be generated by another compiler. (Java's intermediate language, PostScript, and less-known tools such as NME and Lua all come to my mind.) A "high-level" language would be intended for use directly by humans.
And there certainly would be cross-overs. "C" was a language that was expressly conceived for the implementation of Unix® at Bell Labs. It supported an asm {...} construct that allows assembler code to be directly inserted, and most but not all subsequent implementations carried-on that tradition. Unix was therefore one of the first operating systems – if not the first – that was implemented in a high-level language.
All of these terms are, frankly, "too vague to be very useful," except in a very colloquial way.
Your observation of the need to be aware of what is going on "in your code and in 'the level below it'" is very prescient. Always keep this firmly in mind. "The level below it" of course may not or may not directly be "the hardware."
The original problem I was thinking of stems from the fact that a variable is just a construct in the compiler and can't always update the variable which results in PNFASM. Maybe however, it really is a high-level language. Certainly I'll build on top of it more later though...
The syntax listing does not really help us understand what the language actually does. Imagine trying to understand how to use C beginning with only the BNF syntax listing!
You have posted many times about your PNF language, and I have tried to understand much of it, without success. Because you are the author of it and the sole source of information about it, it is really up to you to help us understand its purpose, applications, advantages over other languages, etc.
What would be helpful would be a short introduction to the language, to which you could refer when asking questions about it. If that would be very lengthy, I would suggest that you use your blog space here on LQ to build up a useful set of documentation which you, and we could refer to as needed.
For example, what does "Portable Number Format" actually mean with regard to your language?
What problem does it solve?
How does it compare to other languages?
You have stated that it is better than Java in some sense. How so? What advantage does it have in such a comparison?
How exactly are PNFASM, PNFHA and PNFPP related to each other, and to the problem area of interest?
A simple language description and a few very simple, specific and well written examples would go a very long way toward helping others understand its purpose and use.
Without such a reference point it is very difficult for others here to offer advice or help, or even to understand the questions and examples.
So before posting more lengthy threads about PNF{ASM,HA,PP,etc.}, I would ask that you please devote some effort to providing useful answers to the above questions, some easily accessible language reference docs, and some simple, useful examples of how it may be used to solve some specific, simple test cases. That will allow others to provide answers to your own questions, and help to keep the information in these threads more useful to you and to others.
For example, what does "Portable Number Format" actually mean with regard to your language?
"Portable Numbers Format", is the term I have decided to use, because it seemed like it was not already in use. Let's break it down. "Portable" means that it essentially runs the way Java does most of the time or as needed. More like GCJ actually, because it has a way already to make an executable from it. "Numbers Format", refers to the binary part of the language, which is "Portable Numbers Format", or "PNF" for short. The language consists of two main parts:
1. A signature: "!@.PNF"
* Like a Windows program, that starts with "MZ", it can help tell it apart from another type of file.
2. The numbers: It uses C++ doubles as defined by my compiler. Whitespace doesn't matter, but it makes sense to logically arrange them in a good order.
* This was why I used C++ to create this part, and NOT a compiler compiler. A compiler compiler would have complicated the algorithm for loading the file. C++ makes it easy. First load the signature, which is a String. Then load the numbers, which are doubles. This seems to be part of what makes it comparable in speed to Java bytecode. If it's slower at all, it's not noticeable.
* The "numbers" consist of an instruction, a type, and an opcode. The opcode may be longer than one number, if it's a string. Usually, but not always, the type and the opcode type match each other. There are 5 types:
* VOID
* BOOLEAN
* NUMBER
* CHARACTER
* STRING
These are built in types basically. Numbers are all the same precision.
Quote:
What problem does it solve?
This language makes doing lower level work easier for the average programmer. You would still work at the highest level possible for your particular problem. However, if you need to "tweak" your program, you can do so at the lower levels in an easier way. Because it is human readable numbers, at the lowest level, the computer is sort of meeting you in the middle of the lower language part. You can change it as it's just a text file, and the computer can read it without too much slowdown on most OSs. It will attempt to solve many of the same problems that have already been solved. It will be a general purpose language. Not that I would re-write other programs just for this language's features, but newer programs could be written in it.
It will eventually make programming and creating operating systems easier. I will write a real OS, that is a PNF interpreter, later, when I have the skills. Then you can make an OS by using these languages. I'll provide a standard OS, which I want people to use. But I really want to see creativeness out there for programmers as well, so that the average programmer can create an OS with little effort. Bootloaders and everything. I'll make ways to allow it to be native, if the programmer desires it to be, possibly for a higher fee.
Quote:
How does it compare to other languages?
Other languages are not as easy to use at the lowest levels. And I hope eventually, that they will not be as powerful either.
Quote:
You have stated that it is better than Java in some sense. How so? What advantage does it have in such a comparison?
It's better basically because it's easiest to use at the lower level. And I'm going to be developing things so that I will have many languages written on top of the lower level, possibly using each other. I will encourage others to be creative once I get it out there, and produce their own languages on top of the lower levels. There would be not much wrong with a version of Java written on top of my language instead of it's own bytecode. However, my languages, will eventually be easier to use at the highest level as well. That's because plans are in the works for a new language called "English Like", which will be a specialized type of English, but will use valid English sentances and paragraphs. As far as I know, nobody has standardized programming in this way before. That will be the highest level of this.
Later when voice recognition becomes more standard, a version could be written on, let's say Alexa, that would allow you to use words using your voice to type an "English Like" program, which you could then compile and run on your PNF interpreter. And like always, you can compile that to an actual executable.
Quote:
How exactly are PNFASM, PNFHA and PNFPP related to each other, and to the problem area of interest?
PNF is the lowest level. It is a binary format. PNFASM is an assembler that works on top of PNF, much like we have x86 assembly language compiled to binaries. PNFHA, as I'm discussing here, was something I had in mind to be a high level language that translates to PNFASM. PNFPP is the standard preprocessor for the entire language. It is used many places and is sometimes automatically used.
This page is just meant to be a discussion of whether PNFHA is high-level or not. Also a sort of informational thread about the language, but mostly the first. It is not meant to solve an actual problem.
The first non-textbook and non-test program, I will write in this new language (suite of languages), will be itself re-written in itself. But it can't do that yet. That is how I know the higher level parts are working. When I can do that, the higher level parts are working. It's probably possible, if I wanted to use the lower levels, but even though they're easier to use than other lower level languages, they are still lower level languages, and that act would be crazy. So I need the higher levels to work first before I work on the code for itself.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.