-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Quote:
Originally Posted by
Niya
That being said, I'm still quite proud of it. It's the first time I've done something like this so successfully. I've wanted to do this since I was like 13 years old but such a feat would have been too far beyond my capabilities back then. I've always been fascinated by how programming languages work.
There are a few here that seem to have the same desire to create their own language. Maybe you should set out the specification of the intended language and see if anyone would like to contribute. Semi-colons here we come!
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Quote:
Originally Posted by
yereverluvinuncleber
There are a few here that seem to have the same desire to create their own language. Maybe you should set out the specification of the intended language and see if anyone would like to contribute. Semi-colons here we come!
I'm still very new to this. I don't consider myself an authority on the proper way to write a scripting or programming language. However, if and when I release these projects, it could serve as a guide to others wanting to do the same thing. It would demonstrate how approachable writing a language actually is. It would cover all the necessary basics like tokenizing, parsing and building expression and syntax trees. I even intend to attempt an actual x86 native code compiler in the .Net version.
I just want to cover the basic stuff and show that it could be done and that it's a lot easier than people would imagine. I was actually surprised how easy it turned out to be once you understand some core concepts.
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Quote:
Originally Posted by
yereverluvinuncleber
That is impressive. Personally, if I was building another language of any type I'm not sure I'd want to use the .NET framework regardless of how easy .NET makes it. I think I'd make a step toward using something like C++.
I'd gain no advantage by writing it in C++ over a .Net language. The only advantages to doing this in C/C++ is that it would be far more portable due to the sheer amounts of C/C++ compilers out there for every platform imaginable. The intent of this project is to teach me and later to teach others the bare basics of writing a scripting language. I don't need it to be portable for this. I myself learned a lot about this from studying samples of parsers written in JavaScript, Java and C#.
Also, if the implication is that .Net is unsuitable for writing languages, that's actually wrong. The .Net Framework itself has long had many components already built-in for doing this. For example, there is an entire suit of classes for building an entire program using nothing more than expression trees. You could then invoke other .Net classes to compile it to fully optimized and and fully functional .Net programs.
I just wanted to try my hand at doing it from scratch.
Quote:
Originally Posted by
yereverluvinuncleber
As you have started already, I don't know how you feel about abandoning a project but I always find it difficult to do that even if my intention is to write it another language.
This project actually began in .Net I always intended for it to be a .Net project. My decision to port part of it to VB6 was just an interesting challenge I felt like undertaking but that decision came later. I didn't intent to take it as far as I did but it turned out to be easier than I expected, even in VB6, so I just thought why not go just a little further and create a basic scripting language but I didn't know how exhausting it would be. Also, some of the ideas I have would take way too much effort to implement in VB6 compared to VB.Net so I figured this would probably be a good point to stop and return to the VB.Net version. This one has run it's course.
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Quote:
Originally Posted by
yereverluvinuncleber
I am about to add some sound recording to my utility. Before I do that, I should ask about the appropriateness of my chosen path. I was planning to use the mciSendString API, is there anything I should know about the method I have selected before I dive in? It seems very easy to achieve but there is bound to be some wider knowledge about the pitfalls or limitations of my chosen path, there always is...
I strongly advise you look into obtaining a 3rd party library for this. I've never done this particular thing you're attempting but what you're doing does feel familiar. I remember when writing that 2d engine, I wanted to integrate sound into it which I did. However, I started by attempting to use the Windows API to do it. I soon found out that the Windows API while it could handle sound, was lacking some basic functionality. I can't remember the details but I do remember I eventually had to use FMOD for sound and it covered what I needed perfectly. I experienced a similar thing with graphics. I needed to be able to handle PNGs and Windows didn't provide what I needed so I went and found the Free Image library which gave me more than I needed.
The point is that when it comes to something very specific yet deep like sound and graphics, the Windows API may not cover all that you need. There will always be stuff missing because at the end of the day, Windows isn't meant to be Photoshop or OBS Studio. It's an operating system so they will only cover the bare minimum of the most common cases. When you need more advanced features, you will need to use a library that specializes in whatever it is you're doing.
Now, I'm not saying that you can't do what you want using just the Windows API but be prepared for the possibility that you'd need to do more and Windows won't offer a way to do it.
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
@Niya: You might find this interesting: https://github.com/wqweto/VbPeg
It's a recursive-derscent parser generator, emitting VB6 code from a PEG grammar.
cheers,
</wqw>
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Quote:
Originally Posted by
wqweto
@Niya: You might find this interesting:
https://github.com/wqweto/VbPeg
It's a recursive-derscent parser generator, emitting VB6 code from a PEG grammar.
cheers,
</wqw>
Sweet! I'll be sure to check that one out. Most of the popular ones like ANTLR seem quite intimidating for something reason. I wasn't really sure where to start with some of them or if they can even run on Windows. Also, they produced code for languages I either wasn't familiar with or wasn't interested in. Yours produces VB6 code I'm guessing so it's a language I'm familiar with. I wish I had found it earlier. It looks very simple and approachable.
I was interested in seeing how the generated code would look so it would give me ideas for writing them by hand. I had a lot of trouble with operator precedence when writing a recursive descent parser by hand but the Pratt parser proved to be an adequate solution for that problem.
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Well, you can't expect the generated code to be optimal (far from it) and it probably still has bugs for corner (or not so corner) use-cases.
Still, I like how it supports parametrized rules (an extension to standard PEG syntax) which allows parsing expressions by precendence climbing -- notice how binexpr(Optional ByVal lMinPrec As Long) rule in the linked grammar accepts current precendence reached to work with.
Btw, the linked grammar is for the LLVM's kaleidoscope toy language for the LLVM bindings for VB6.
cheers,
</wqw>
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Quote:
Originally Posted by
wqweto
Well, you can't expect the generated code to be optimal (far from it) and it probably still has bugs for corner (or not so corner) use-cases.
I mainly wanted to use it as a guide since I was writing the parser by hand and early on it was difficult for me to formulate how to parse certain types of syntax elements. I also used this site as a guide to help me think correctly think about the kind of output I wanted my parser to produce.
Quote:
Originally Posted by
wqweto
Yea, this is exactly why I love the Pratt parsing algorithm. It also uses precedence climbing. It is such a breeze to control operator precedence in that algorithm. The core of a Pratt parser has a function with the same signature as that binexpr function. You pass in a binding power and algorithm keeps parsing to the right as long as the next operator has a higher binding power. It's really clever.
I'm curious. Can your PEG parser handle unary precedence as well? One of the big things that drew me to the Pratt parser was the ability to control the precedence of the unary operator which was difficult to do by hand with just recursive descent parsing. I wanted to be able to produce an expression tree that would evaluate this -3^4 like this -(3^4) instead of this (-3)^4. This requires that the exponent operator have higher precedence.
Quote:
Originally Posted by
wqweto
I haven't quite worked my way up to being able to fully grasp things like LLVM yet. I'm still very new to this and there is still a lot I do not know about this domain of language development. But I'll definitely check it out. I'd love to be able to use LLVM one day. The guy that invented Rust used this for his compiler I believe. I think TwinBASIC also uses this for it's own compiler or it is intended in the future.
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
By the way I release it into the VB6 code bank. I will attempt to take it even further in the .Net version.
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
I am adding speech recording and the transfer of the resulting WAV file to my project. I am just using mciSendString as it appears to be a very simple addition and it works. No need to do anything fancy so I don't yet need FMOD but it is an interesting recommendation for future projects.
https://www.vbforums.com/images/ieimages/2021/10/2.jpg
Shows the simple controls and recording lamp that'll do for the moment. The switch on the left starts the recording, lights the lamp and then a timer runs to limit the recording time to 65 secs. The switch on the right, dims the lamp, stops the recording and initiates the transfer of the temporary WAV file, giving it a unique name in the process, and adding a reference in the chat output.
https://www.vbforums.com/images/ieimages/2021/10/3.jpg
Right click and view image to view full size.
The new buttons and lamp look correct on the speaker grille section. I may have to add an indicator of the recording time but that'll come later.
Step by step, my application progresses.
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Quote:
Originally Posted by
Niya
I think you should make attempts to keep your VB6 version in synch. It will keep your brain working and sharpen those wits even further. It will also silence your VB6 critics that imply your VB6 skills are insufficient to comment in comparison of the two languages. It could also act as a live demonstration of your skills and your argument.
-
1 Attachment(s)
Re: Getting the ball rolling. Which VB6 projects are you working on?
I am experimenting with an indicator of the recording time...
https://www.vbforums.com/images/ieimages/2021/10/17.png
A glass thermometer where the red alcohol line moves along as the recording time progresses.
Attachment 182551
It will appear when a recording starts and disappear once the recording has completed and has been sent. Some minor changes graphically required but it should do the job.
Dil. hated my design initially, I wonder if he still hates it? Probably.
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Quote:
Originally Posted by
Niya
SearchingDataOnly would benefit from your VB6 code - there, I said it. In this way you could make up to him too. You could work in partnership and a new era of positive East/West relations might result.
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Quote:
Originally Posted by
yereverluvinuncleber
I am adding speech recording and the transfer of the resulting WAV file to my project. I am just using mciSendString as it appears to be a very simple addition and it works. No need to do anything fancy so I don't yet need FMOD but it is an interesting recommendation for future projects.
I wasn't suggesting FMOD per se as it's more about sound playback. I was using it as an example of what I needed when the Windows API failed to meet my needs for sound playback. I was suggesting that it is possible that you may encounter a similar situation where the Windows API fails you and you may need to look up a 3rd party solution. But you seem to doing fine so it's all good.
FMOD is a good library though. I don't know if it's still relevant today but I remember it being a very good sound library.
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Quote:
Originally Posted by
yereverluvinuncleber
...SearchingDataOnly would benefit from your VB6 code...
Well the way that he speaks, I'd swear he has already written an IDE and compiler more advanced than anything ever created by Microsoft. Who even knows at this point :confused:
Quote:
Originally Posted by
yereverluvinuncleber
there, I said it
Lmao...
Quote:
Originally Posted by
yereverluvinuncleber
You could work in partnership and a new era of positive East/West relations might result.
Lmao....you're a funny guy ;)
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Quote:
Originally Posted by
yereverluvinuncleber
I think you should make attempts to keep your VB6 version in synch.
There's still a lot of stuff I have to work out, for example, compiling branch code(If...Then, loops, goto etc) into stack based instructions. I'm not sure yet exactly what kind of jump instructions I need for the VM or how to use the expression tree to calculate jump offsets or even if I should use jump offsets instead of absolute jumps. This is a lot to work out and quite frankly VB6 distracts me from it because I have to devote too much of my cognition to working around VB6's limitations. In VB.Net, I can focus very directly on what I want to achieve without all the "side quests" like writing and debugging my own collection classes.
However, when I figure all of this out, I can then focus on bringing them to the VB6 version because I'd have already solved it. This is exactly what I did before I started the VB6 version I recently released. I'd already worked out the parsing and how to use expression trees to do various things so I came into VB6 already knowing what to do. I need to focus now on compilation. There is a lot there that right now I that I have no idea how I'm going to accomplish. I am confident though that I can do it, but I just need to be able to focus completely on that.
Quote:
Originally Posted by
yereverluvinuncleber
It will keep your brain working and sharpen those wits even further. It will also silence your VB6 critics that imply your VB6 skills are insufficient to comment in comparison of the two languages. It could also act as a live demonstration of your skills and your argument.
This is a valid point but like I said above, I need to focus on one thing at a time. I don't want to have to think about how I'm going to do this or that in VB6 while trying to figure out how to make a rudimentary compiler at the same time. I can do it if I have to but I don't have to. I'd be able to work much much faster in VB.Net towards solving the problems I need to solve, then I could implement them in whatever language I want.
The thing about this whole thing is that I'm learning while I'm doing it. It's not like I'm doing graphics or Win32 GDI/User32 stuff which I already know a great deal about. I'm in completely new worlds here. I need every advantage I can get. :)
-
1 Attachment(s)
Re: Getting the ball rolling. Which VB6 projects are you working on?
https://www.vbforums.com/images/ieimages/2021/10/23.png
Just added some colour to the radio buttons as well as a new Play button. A dash of red and green always helps.
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
I continue to make progress even if it is exceedingly slow by the standards of you competent lot.
I have added record and play lamps. The play lamp extinguishes itself when the current WAV file has finished playing. To determine when the lamp should switch off I could divide the file length by 11,000 (khz) that would give me a rough length of the play time. Instead, I am counting the length during recording and then adding that duration number to the unique filename given to each output WAV file. When playing I use that duration and extract it to send to a timer that extinguishes the lamp after the duration plus one second. There is probably a more elegant method using mciSendString querying the play state or similar but it works and it'll do.
I'm adding automated backups and archiving to the data. In addition I am adapting it to use other file/folder sharing utilities such as Google Drive or Onedrive, if they can share files and folders and cause a resource to appear locally to Windows then my program can use it.
My programming partner is developing the javascript version simultaneously and it runs mainly on Mac OSX, he is having trouble recording MP3 files using the Mac OS, it wants to create M4A format files only. It seems OSX wants to restrain you from using industry standard file formats and it does not seem to have the same level of API access to do this or that as we expect from Windows.
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Mac OS? That operating system is trash. lol. I wish him the best of luck with that.
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Part of the 'fun' is ensuring it works correctly when the partner's machine is OSX. Finding the obstacles and climbing up or around them. We have a two windows clients, one written in javascript for the desktop and one using VB6. They both can transfer unicode text, handle PNGs, record and play WAV/MP3s and support a semi-realtime chat, or that is at least the aim. The two Windows clients are largely done and dusted.
The OSX version uses the same .js codebase but it appears that it is the Mac's o/s that does not yet allow the scripting and creation of MP3 files. It does have QT that can be scripted to do this or that using Applescript but so far I am told it cannot be scripted to export MP3s. It does seem a limitation and the inability of the system to open itself via APIs in the same way as we are used to via VB6 does also seem a limitation.
Regardless it is a learning process and it opens up to new problems that need to be surpassed. Each resolution is a learning experience. It would have been much easier in VB^ but I would have learnt much less. The result would have been less useful so I am content I chose this route.
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Wait, I just realized something....you guys wrote the same application twice? Once in VB6 and once in JavaScript?
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Quote:
Originally Posted by
Niya
Wait, I just realized something....you guys wrote the same application twice? Once in VB6 and once in JavaScript?
No. We had it in javascript already, completed and working. I created a VB6 version because. I think that's it.
The javascript version uses pure .js but the engine is no longer supported and increasingly difficult to maintain on os/x. I created in VB6 using different methodology rather than trying to migrate in order to find out what problems might arise in the process. We have ended up with a much improved tool and the end result is better than the one we originally had in hand. Sometimes it is useful to see what the other language has to offer and in addition we have retrofitted the same functional changes to the .js version - which works on both Windows and OS/X.
I suppose I really created the VB6 version as I needed a break from my SteamyDock VB6 Magnum Opus.
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Also, the first version was done without my signature graphical abilities! The .js version was coded largely by my coding partner with design direction and documentation from me. All my steamy and diesel gauges are all my own work and you can tell that from the design...and when you look at the shoddy code. The original chat program was just a functional one with no graphical frills. It is now starting to acquire those.
The VB6 version has become the template.
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Ah ok. What's the application used for? Is it like some kind of internal WhatsApp type thing?
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Quote:
Originally Posted by
Niya
Ah ok. What's the application used for? Is it like some kind of internal WhatsApp type thing?
Yes, that's it. You can drop files of any type, even folders. It is primarily a text based chat for person to person, development types to swap ideas and work together more efficiently without all the social media overhead. It now has recording speech capability. Alternatives exist but they aren't mine and they all have an agenda that does not match my/our own.
It uses Dropbox as the interchange medium and it could use any sharing utility, Onedrive, Google Drive &c. It is encrypted by Dropbox so not full end-to-end encryption but point to point it is secure.
When I can find suitable encryption code for both .js and VB6 using an AES method that works for both systems I may add the option for end-to-end encryption but we'll see... I have a lot to do in the meantime.
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
My fellow developer in the UK is in Sheffield and I am in Norfolk by the coast so not quite internal...
It only supports two person interaction at the moment but I am thinking of adding other options, three way chat &c.
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Does it also use DropBox for text messages and voice notes or just for sending files/folders?
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Quote:
Originally Posted by
yereverluvinuncleber
It only supports two person interaction at the moment but I am thinking of adding other options, three way chat &c.
Like group chat in WhatsApp?
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Quote:
Originally Posted by
Niya
Like group chat in WhatsApp?
Exactly. It uses dropbox for the chat text too. That is the beauty of the thing, Dropbox provides the backbone and the mechanism. I just create a thin client.
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Quote:
Originally Posted by
yereverluvinuncleber
Exactly. It uses dropbox for the chat text too. That is the beauty of the thing, Dropbox provides the backbone and the mechanism. I just create a thin client.
Errr....not sure how I feel about that. If I were doing this I'd have used Winsock with my own protocol for this so I won't have to depend on a 3rd party site. I would have full control over the communication with the freedom to implement whatever I wanted and how ever I wanted it.
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Quote:
Originally Posted by
Niya
Errr....not sure how I feel about that. If I were doing this I'd have used Winsock with my own protocol for this so I won't have to depend on a 3rd party site. I would have full control over the communication with the freedom to implement whatever I wanted and how ever I wanted it.
For the moment though it is sufficient. Those sort of major improvements can be implemented later. We are using it every day for general communications so getting and keeping the thing working is important. The good thing is that you can use any utility that gives you shared files and folders.
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Ah ok. Fair enough. Well keep working ;)
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Quote:
Originally Posted by
Niya
Ah ok. Fair enough. Well keep working ;)
Not just that. The original is written in javascript and won't be easily able to replicate that sort of proposed functionality. At the moment the javascript version acts as the specification and I have to be able to ensure that with any new direction it continues to work with what I suggest. In the future I will take it further and possibly offer that and other improvements as alternatives but not now.
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Quote:
Originally Posted by
Erwin69
E.g. moving the 11 + buttons into an array, will reduce the control count with 10. Looking at the screenshot above, the 11 Labels, 11 combos, and 22 buttons within the Texts-frame could be reduced to 4 controls, while still keeping things logically.
I've had to take your advice regarding using control arrays to reduce the number of controls on a form. I am butting my head up against this whenever I have to create a complex pref.s/config. screen with a lot of configuration options.
Prior to bundling the controls into arrays, I have taken all the label controls, on a frame by frame basis and for each control I have moved the existing text from the Name property to the Tag property so I can still identify which label applies to which configuration section. The problem arises later when you are debugging and cannot easily identify what a specific control is for. This way the Tag property will still be there to assist.
It will be a pain if I ever migrate the code to .NET, I am just still hoping for RADBasic/TwinBasic so I never have to! I am hping the 255 control limit per form is one quirk that does not have to be built in to a new version of VB6.
Q. Does VBA suffer from the same limitation?
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Quote:
Originally Posted by
yereverluvinuncleber
Not just that. The original is written in javascript and won't be easily able to replicate that sort of proposed functionality. At the moment the javascript version acts as the specification and I have to be able to ensure that with any new direction it continues to work with what I suggest. In the future I will take it further and possibly offer that and other improvements as alternatives but not now.
I feel confident that any functionality that exists in the JavaScript version can also be reproduced in the VB6 version. I really think the VB6 version should be the one leading the charge here to be honest. JavaScript was originally designed for manipulating the HTML DOM where as VB6 was designed for exactly this sort of "thick client" programming.
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Quote:
Originally Posted by
Niya
I feel confident that any functionality that exists in the JavaScript version can also be reproduced in the VB6 version. I really think the VB6 version should be the one leading the charge here to be honest. JavaScript was originally designed for manipulating the HTML DOM where as VB6 was designed for exactly this sort of "thick client" programming.
Except in this chicken and egg scenario, the javascript version was the chicken and VB6 version was a mere egg.
The VB6 version is growing and starting to outpace the .js desktop version so it'll be the chicken soon.
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
The irony here is that the old "chicken and egg problem" always had an answer. The egg came first. That's how mutation and evolution works.
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Quote:
Originally Posted by
dilettante
The irony here is that the old "chicken and egg problem" always had an answer. The egg came first. That's how mutation and evolution works.
In this case it was a virgin birth or a transubstantiation from the elemental concepts in the javascript version that formed a first VB6 'egg'.
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
Do you still hate my design Dil?
-
Re: Getting the ball rolling. Which VB6 projects are you working on?
You may know my situation, looking after a dementia-ridden mum whose care slows my coding progress to that of a snail, I mention this as I am always embarrassed by my lack of progress...
https://www.vbforums.com/images/ieimages/2021/11/4.png
I have actually implemented the red alcohol glass recording timer using a VB6 line control, I tried it with various images at 12% intervals but it works better with a more fluidly changing line.
Every now and then I like to take a break from programming and indulge myself in a bit of graphics that is satisfying to create and implement.
I have fixed the form resizing incorrectly on Win10 style windows with thicker title bar and thinner sides, I did not know that a form's overall width/height had to take these into account. I am learning something new all the time.
I have implemented Elroy's balloon tooltips and it gives the whole app a much more professional feel.
In addition to VB6 coding. I am upgrading my development desktop environment which will also be very satisfying to complete.