Introduction to PNF - a
Posted 04-28-2017 at 08:55 AM by des_a
See my introduction to PNF for more what the current version of PNF is like. So that you don't need a login for my other site, I'll reproduce the 3 files given there, here. Though I would probably recommend getting a login there too at some point.
Total Comments 26
Comments
-
Hi Dennis!
I have not had time to read through all these yet, but will try to do so over the weekend. Thanks for posting them!
I have now polished my own Flex/Bison example application and have made notes for the blog pages I have in mind for it, but have not had time to post those this week - perhaps another project for the weekend.
The application I wrote is a natural language calculator which accepts input as valid english language numeric expressions (and optionally accepts numbers and mixed expressions) and returns the result in english, optionally numerically, or both.
It works really well! All written from scratch, but I added more features than I originally had in mind!
Here is a preview sample of interactive output (Works interactively or reads from file(s)).
Code:> one hundred three thousand seven hundred four plus two hundred six one hundred three thousand nine hundred ten (103910) > seven hundred seventy seven divided by (fourteen/2) one hundred eleven (111) > 12 * (eight minus four) forty eight (48)
Code:> twelve hundred one hundred two stdin: 9.20-9.26: error syntax error
It has been fun!Posted 04-28-2017 at 06:45 PM by astrogeek
Updated 04-28-2017 at 10:37 PM by astrogeek (copy/paste error) -
Quote:Hi Daniel!
Posted 04-28-2017 at 10:12 PM by des_a -
Cool! I hope you read about mine too. Developing this on top of my language would be a pretty good project, once I release my first released version of my language(s). I would encourage development of other languages besides my own on my platform. For now in it's limited development stages, it's Windows only, and not only that, but Windows-64 bit too. But it could be compiled to anything. I might release it as a release for development purposes soon, as soon as I get more information put out about it...
Posted 04-28-2017 at 10:16 PM by des_a -
I hope you release a development version of that, and I hope that you like my idea of making it compile to my low level parts of my language(s) too...
Posted 04-28-2017 at 10:17 PM by des_a -
Quote:My name is actually Dennis. My username stands for my name: Dennis Earl Smiley.
I am planning to work through your docs over the weekend, probably Sunday as I will be away most of Saturday.
Apologies again for the name confusion...
RobertPosted 04-28-2017 at 10:36 PM by astrogeek -
Quote:Apologies again for the name confusion...
Posted 04-28-2017 at 11:20 PM by des_a -
Quote:I would suggest that you start with a single core concept on which others are to be built. Explain it in the clearest and simplest terms possible, in a single document or place which you can update as required. Then, once you can see that your audience has grasped that concept, place the next brick on that foundation, with the same simplicity and clarity. Before long you will have a self-supporting superstructure of concepts and sufficient understanding among others to begin to build some real excitment!
I am trying to do as you suggest. Can't wait to explain more, but I'm trying to wait until at least one person "get's it", or "appears to get it", before I move on to more. If anything, this is my best designed "program" ever. Though not all of it is on paper anymore. It all conforms to it's design, whether that design turns out to be "good" or "bad" in the end. It will be more likely than most to produce good, working results. In fact, I've had years of design before I even could write a bit of "working" code for it.Posted 04-28-2017 at 11:26 PM by des_a -
Hi Dennis!
I finally had time to read through your docs this evening.
For the first time I can see what your instruction set actually does - the internal virtual machine has definitely been a missing piece for as long as we have been communicating about your PNF language.
The description of that VM gives the much needed context for the instruction set and assemblers and compilers we have seen! You have written an instruction set which covers most of the basic math and logic operators for your VM, along with basic I/O. I am a little confused by the events however - I can see how you would trigger an event from the software, but I do not see how you catch system generated events (hardware events, hw/sw interrupts, kernel messages, etc.). Is that not yet implemented perhaps?
I worked all the way through the tutorial. Some questions/observations that come to mind, in no particular order of importance...
All opcodes, types and data are decimal numbers, is that right? So the registers in the VM must also be actual floating point registers...? What happens when a number with fractional part is entered for an op code or an address?
It also appears that every instruction required three numbers, opcode, type and data, even if the last two are VOID, is that right? For example, a POP from the stack is still "POP TVOID 0V", not simply POP.
I see the VM includes an instruction counter, but I am very unclear on the address register(s). I also saw a few times that the person writing the program must enter a target address for a branch (although labels are also suported). I suppose the assembler would handle that, but that is for another day.
And can the program allocate memory for its own use, similar to malloc or new operators?
Where would we get the interpreter/VM for running small programs? I seem to recall that it is only for window$ (which is a problem for myself - I have no access to that platform). Will it compile on Linux/Unix?
Anyway, thanks for the tour, that does put some focus on many things that have remained a bit mysterious when looking only at the "language" with not machine context.
Good luck!
RobertPosted 04-30-2017 at 10:34 PM by astrogeek -
Quote:I am a little confused by the events however - I can see how you would trigger an event from the software, but I do not see how you catch system generated events (hardware events, hw/sw interrupts, kernel messages, etc.). Is that not yet implemented perhaps?
Quote:EVENTS IN PNF
=============
HEVENT - A hardware event Hardware generates this type of event, such as if a refrigerator was plugged into the system.
SHEVENT - A system hardware event System hardware, such as the processor, generates these types of events
EVENT - A software event Software will generate these types of events
EXCEPTION - An exceptional circumstance Circumstances, such as a breakpoint will generate an exception
INTERRUPT - Any other type of event Any other event will trigger this type of event
There are Hardware events, which are for things like if a refrigerator was plugged into a USB port. Then the refrigerator might generate one of these.
Then there are "System" hardware events, such as the processor giving off signals to the programs.
Events are just software events, which are equivelant to most of today's INT instructions.
Exceptions are basically like some processor Exceptions that occur in hardware.
Interrupts are any other type of event.
I have coded the means for coding events, but not the events themselves at this point. That is left up to the programmers right now. Like I said, this language is designed for OS programming, and my event system will be very useful later on, when I get to the point where that is actually possible to code an OS in this language.Posted 05-01-2017 at 02:58 AM by des_a -
Quote:All opcodes, types and data are decimal numbers, is that right? So the registers in the VM must also be actual floating point registers...? What happens when a number with fractional part is entered for an op code or an address?
Posted 05-01-2017 at 03:01 AM by des_a -
Okay, here is your first answer. Here it is as it stands right now. The numbers are read in as floating point (C++ type double). %instruction, %type, and %opcode are all of C++ type unsigned long. That means no negative numbers, and no fractional parts. They are converted via a cast operator when assigned to those registers. They are converted as "(long)". There might actually be two C++ conversions going on there, because of my specific code, but the conversion DOES work.
The effect on the opcode, is that it will lop off the fractional part. I use a C++ switch statement to tell what type of instruction it is. And due to the fact that a C++ enum can only be coded as a non-fractional number, plus the fact that the switch can only take numbers with non-fractional parts, this needed to be somewhat of the case. In the languages I'm developing, none of these things will be issues. So I could code itself in a more straightforward manor already as I'm seeing...
However, I'm not to that point yet, and will opt for some backwards compatibility when I can do that.Posted 05-01-2017 at 03:15 AM by des_a -
Quote:It also appears that every instruction required three numbers, opcode, type and data, even if the last two are VOID, is that right? For example, a POP from the stack is still "POP TVOID 0V", not simply POP.
Posted 05-01-2017 at 03:18 AM by des_a -
Quote:I see the VM includes an instruction counter, but I am very unclear on the address register(s).
Basically, there is a concept of memory in PNF. Memory is initially filled with whatever you give it in the program. The "code" if you will. The memory is like a special form of an Array, sort of. It is addressed, starting with 0, and goes as high as needed, or as high as your computer's physical memory will allow it to go. I fill it by putting the memory on the C++ heap. That way, memory can grow, or (I don't think off of the top of my head it does), shrink when needed. So there is no fixed upper bounds on the memory you can have, except what your physical computer allows you to use. Such as the OS the interpreter is running on and everything, that is, if it's running on an OS.
There is an instruction for getting the upper bounds of the memory, I believe, and I think I demonstrated it.Posted 05-01-2017 at 03:26 AM by des_a -
Quote:I also saw a few times that the person writing the program must enter a target address for a branch (although labels are also suported).
Posted 05-01-2017 at 03:29 AM by des_a -
Quote:I suppose the assembler would handle that, but that is for another day.
Posted 05-01-2017 at 03:31 AM by des_a -
Quote:And can the program allocate memory for its own use, similar to malloc or new operators?
Posted 05-01-2017 at 03:32 AM by des_a -
Quote:Where would we get the interpreter/VM for running small programs? I seem to recall that it is only for window$ (which is a problem for myself - I have no access to that platform). Will it compile on Linux/Unix?
I'm sorry for it being Windows only. I don't want the eventual version to be Windows only, but the version right now seems to be. That's because I am still doing heavy network work too, and I only have access to a Windows client right now. I have Linux servers all over the place. However, I want it to run in Linux too, and really want to get to where I have again a multiboot system with GRUB as my bootloader.
I will have to do some work on my network to get it this way! For now, things are the way they are though.
Yes, I would hope that it compiles as is in Linux/Unix, under G++. It'll make my work easier later on. It relies on my desLib to function, however. You have to install desLib to your include directory to compile it. There is no binary code for desLib. It probably comes down to whether I have designed desLib compatible enough as I wanted to or not.
I won't be posting the source code, just the binaries. But, that brings me to a point. Perhaps I could either set up a temporary VM and try to compile it on that, or you could always try to run it with WINE or WINE64. That should work too.
I think I'll probably simply opt for the VM situation for now. I want to play with Linux clients more anyway...
It is binary only in it's current development stages for which I will distribute the whole thing. That is, unless I need troubleshooting help, and then possibly the whole thing may later be found on the site, but I won't disclose when it is and when it isn't the current version of it on the site.
Why? I want to protect my development.
The final version that is not considered alpha or beta should be a type of open source, however. Right now it's not quite fitting my definition of alpha even, so it's primarily closed source all the time. Unless I'm troubleshooting it. But tell me what type of binary you need, and I'll try to make it that type, when I post it. It should be a type of .ELF, if you want it to run under Linux, I'd guess. I have lots of compilers that can generate an .ELF. Maybe I could also learn to cross-compile?Posted 05-01-2017 at 03:47 AM by des_a -
Well I must say it is more than just a little disappointing to come all this way and find... nothing.
With all the urgings to write code in your special language, and having put forth some honest effort to try to understand the basis of your claims for it, then to find that there is not even a simple interpreter available for it is very unsatisfying, to say the least.
And then to hear that when it is released it will be binary only is a show-stopper for myself. Right at this moment I think I have little or no interest in pursuing it further, at least until I see...
1. The distinguishing, compelling concept which sets this language apart from xyz-p-code, explained in 25 words or less.
2. The Des_a license mentioned in your posted files, not a place-holder.
3. The working source code for the interpreter, binary is a non-starter for me.
4. A copy/paste working example program which I can run immediately on that interpreter.
Anything else is really just words, and I think it is probably well past time to produce the meat of this matter.
I do not mean to discourage you, you obviously have put much effort into your project and have great hopes for it, but frankly you will need to show some very compelling reasons to re-kindle any interest on my behalf at this point. You have a perspective on your project which you have, so far, not communicated (to me) in any way that I can get a handle on. I hoped that when I could run a small program in that language I might understand the point of it. But, alas...
I wish you good luck with it, and remain happy to answer specific questions you may have, but I have no remaining interest in learning and debugging the opcode set of a simple VM which I cannot build and run.
Good luck!
RobertPosted 05-02-2017 at 01:00 AM by astrogeek
Updated 05-02-2017 at 01:19 AM by astrogeek -
Okay. The only reason I was wanting to NOT do the source code, was to protect myself. I know quite a bit (at least in these languages) about programming, but not as much about the US laws surrounding it's use as far as any type of business. I could post the source code if that's the best way to get it to compile and work on a system (such as) yours. It would NEVER be intended to be binary only forever, either way. I guess I will post it here in the next few posts, and then you can play with it's execution. I'll explain more about stuff such as the liscense in those posts too. Here goes!
Posted 05-02-2017 at 03:53 AM by des_a -
Oh! I guess it won't let me post files here! I have to start a new entry to do that. I guess I'll start by starting a new entry. Sorry it won't let me do it the way I want.
Posted 05-02-2017 at 03:55 AM by des_a