LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs > des_a
User Name
Password

Notices


Rate this Entry

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.
Attached Files
File Type: txt instruction_set.txt (25.9 KB, 13 views)
File Type: txt PNF-extensions.txt (502 Bytes, 4 views)
File Type: txt PNF-tutorial.txt (71.8 KB, 13 views)
Posted in Uncategorized
Views 1889 Comments 26
« Prev     Main     Next »
Total Comments 26

Comments

  1. Old Comment
    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)
    And it knows a bad expression when it sees one...

    Code:
    > twelve hundred one hundred two
    stdin: 9.20-9.26: error syntax error
    I'll post the details within the next few days... hopefully (lot's more to it than this!).

    It has been fun!
    Posted 04-28-2017 at 06:45 PM by astrogeek astrogeek is offline
    Updated 04-28-2017 at 10:37 PM by astrogeek (copy/paste error)
  2. Old Comment
    Quote:
    Hi Daniel!
    My name is actually Dennis. My username stands for my name: Dennis Earl Smiley. That is all I will say about that though. Now you know to call me Dennis. Otherwise, referring to me by my username works okay too here... If you want, you may disclose your name. I'm getting to know some of your expertise by now.
    Posted 04-28-2017 at 10:12 PM by des_a des_a is offline
  3. Old Comment
    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 des_a is offline
  4. Old Comment
    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 des_a is offline
  5. Old Comment
    Quote:
    My name is actually Dennis. My username stands for my name: Dennis Earl Smiley.
    Sorry, I knew that from looking at code you have uploaded in the past! I was communicating with another Daniel earlier today and my tired old brain cell just transposed the name... sorry for the lapse!

    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...

    Robert
    Posted 04-28-2017 at 10:36 PM by astrogeek astrogeek is offline
  6. Old Comment
    Quote:
    Apologies again for the name confusion...
    It's okay. I didn't realize I had at some point without even meaning to, disclosed it before. But, of course, that's okay with me.
    Posted 04-28-2017 at 11:20 PM by des_a des_a is offline
  7. Old Comment
    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!
    astrogeek (from: http://www.linuxquestions.org/questi...073/page3.html)

    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 des_a is offline
  8. Old Comment
    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!

    Robert
    Posted 04-30-2017 at 10:34 PM by astrogeek astrogeek is offline
  9. Old Comment
    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?
    Here is a quote from my events section:

    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
    I have not coded very many events as of now. But this language is designed so that it could be used for OS programming later. Some of the other types of events will be used (maybe coded in), when that becomes an actual possibility. I need to know more about today's OS programming before that is possible though.

    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 des_a is offline
  10. Old Comment
    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?
    Yes, all the numbers that the interpreter loads are floating point, of C++ type double. I do NOT believe that the registers %instruction, %type, and %opcode are floating point, but I will have to check on that. As for what happens when a fractional part is entered for an opcode, I'll have to check on that. I'll check and then get back to you on that...
    Posted 05-01-2017 at 03:01 AM by des_a des_a is offline
  11. Old Comment
    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 des_a is offline
  12. Old Comment
    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.
    True. Completely true. Yes, to make the language simple, I decided later on when implementing it that they would always have an instruction, a type, and an opcode. Most of the time, an opcode follows the same type as the type, but not always. I don't break that rule and make it be a different type, unless I really see the need for it, and sometimes I have seen the need for it.
    Posted 05-01-2017 at 03:18 AM by des_a des_a is offline
  13. Old Comment
    Quote:
    I see the VM includes an instruction counter, but I am very unclear on the address register(s).
    I don't see where I'd had an address register. I did have a few times, [address]. This is an address that you give it.

    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 des_a is offline
  14. Old Comment
    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).
    Yes. This language that the interpreter interprets, was based in part but not whole off of a version of SML (simpletron machine language) I found in a Java book, and the fictional assembly language's machine language I found in a version of a computer dictionary. No code was taken from either one. Just design ideas. That was how it worked there, so that is how it works here.
    Posted 05-01-2017 at 03:29 AM by des_a des_a is offline
  15. Old Comment
    Quote:
    I suppose the assembler would handle that, but that is for another day.
    The interpreter is fully capable of handling labels with strings. It just uses the PNF version of a string, not the human readable version of a string. It's coded in all numbers.
    Posted 05-01-2017 at 03:31 AM by des_a des_a is offline
  16. Old Comment
    Quote:
    And can the program allocate memory for its own use, similar to malloc or new operators?
    Internally, the interpreter uses new and delete a lot from C++. Right now, it's not possible to use such things in the actual language it describes, but might be possible later.
    Posted 05-01-2017 at 03:32 AM by des_a des_a is offline
  17. Old Comment
    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 have yet to distribute it. I will probably post a development version of it later on, after some more concepts are understood.

    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 des_a is offline
  18. Old Comment
    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!

    Robert
    Posted 05-02-2017 at 01:00 AM by astrogeek astrogeek is offline
    Updated 05-02-2017 at 01:19 AM by astrogeek
  19. Old Comment
    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 des_a is offline
  20. Old Comment
    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 des_a is offline
 

  



All times are GMT -5. The time now is 04:48 PM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration