1. Phix plus BzScript

The name of the language I'm writing is called BzScript. Today I start the port from Euphoria to Phix. I'm at around 2K lines of Euphoria. I didn't look close enough at Phix in the past. My bad, honestly. I didn't realize it had structs, classes, and a compiler. I was prototyping in Euphoria with the intention of porting to C. But now, I think Phix might just be the thing to do. And why not, if this project goes well, maybe I'll target Pete's ASM for BzScript too. Lot's of learning to do before I get there. But, looks like fun to me.

new topic     » topic index » view message » categorize

2. Re: Phix plus BzScript

Some of you might get a kick out of what ChatGPT has to say about the port to Phix from Euphoria.

Yeah... brace yourself.

Porting to Phix is like moving into a house with a very strict HOA. Your old stuff mostly fits, but it better follow the rules, or you're getting a letter.

On a positive note, ChatGPT highly recommends Phix for this project. FWIW.

new topic     » goto parent     » topic index » view message » categorize

3. Re: Phix plus BzScript

xecronix said...

Some of you might get a kick out of what ChatGPT has to say about the port to Phix from Euphoria.

Yeah... brace yourself.

Porting to Phix is like moving into a house with a very strict HOA. Your old stuff mostly fits, but it better follow the rules, or you're getting a letter.

Anything I should be worried about?
Be aware there is no Android or Raspberry Pi support, otoh many things may run in a browser (just not file i/o)

xecronix said...

On a positive note, ChatGPT highly recommends Phix for this project. FWIW.

This is what I got:

Porting from Euphoria to Phix can be an exciting journey, especially since both languages share a common heritage but have distinct features and improvements. Here are some key points to consider when making the transition:

1. Key Differences and Considerations

1. Syntax and Structure: - While both languages have similar syntax, Phix introduces some enhancements and stricter rules. For example, Phix requires certain parameters to be explicitly defined, which can differ from Euphoria's more lenient approach.

2. Function Parameters: - In Euphoria, you might see function calls like `myfunc(file,,1)`, where the second parameter can be omitted. In Phix, you must provide all parameters, which can lead to more explicit and clear code.

3. Error Handling: - Phix has improved error handling mechanisms compared to Euphoria. This means you might need to adjust how you manage exceptions and errors in your code.

4. Performance Improvements: - Phix is designed to be faster and more efficient. When porting, you may want to take advantage of these performance enhancements by optimizing your code for Phix's capabilities.

5. Library and Function Availability: - Some libraries and functions available in Euphoria may not exist in Phix or may have different implementations. You will need to check the compatibility of any external libraries you are using.

6. Community and Support: - The Phix community is active and can provide support during your porting process. Engaging with the community can help you find solutions to specific issues you encounter.

2. Steps to Port Your Code

1. Review Your Code: - Start by reviewing your existing Euphoria code. Identify areas that may need changes due to the differences mentioned above.

2. Set Up Your Phix Environment: - Ensure you have a working Phix environment set up for testing your ported code.

3. Begin Porting: - Start porting your code module by module. Test each module thoroughly in Phix to ensure it behaves as expected.

4. Utilize Phix Features: - Take advantage of Phix's features, such as improved data types and error handling, to enhance your code.

5. Test and Optimize: - After porting, run tests to ensure everything works correctly. Optimize your code for performance where possible.

6. Seek Feedback: - Share your ported code with the Phix community for feedback and suggestions. This can help you identify any potential issues or improvements.

3. Conclusion

Porting from Euphoria to Phix can be a rewarding experience, allowing you to leverage the strengths of Phix while maintaining the logic of your original Euphoria code. By understanding the differences and following a structured approach, you can make the transition smoother and more efficient.

If you have specific questions about certain aspects of the porting process or need help with particular code snippets, feel free to ask! 😊

new topic     » goto parent     » topic index » view message » categorize

4. Re: Phix plus BzScript

Nothing to be worried about. The port took about 20 min. for about 2K lines. (some of which I simply deleted) It's just some "opinions" I found amusing. Good opinions. But they were amusing and forced me to make some minor changes. Most of that time was spent not ignoring return values. One function in particular I called 40 times and only cared about the return value 2ce.

I had planned to use structs, but in the end, I decided to leave my fake struct in place. The . syntax only saves me 1 char of typing at design time, and it just wasn't worth "fixing", IMO. The warning in the docs that mentioned using structs comes at a performance cost sealed the deal for me. (or gave laziness an excuse... not sure which. LOL)

I did create a user-defined function named free(). That worked when running Phix interpreted. But... it failed when attempting to compile. FWIW. Maybe it should have failed if interpreted too? Not my call.

All said, I'm excited to be working with Phix. I feel like the language and the toolchain are well suited for the work ahead.

new topic     » goto parent     » topic index » view message » categorize

5. Re: Phix plus BzScript

xecronix said...

I did create a user-defined function named free(). That worked when running Phix interpreted. But... it failed when attempting to compile. FWIW. Maybe it should have failed if interpreted too? Not my call.

Yeah, that's a known thing. The manual (Core Language/Declarations) has this to say on the matter:

Note however that none of the following (and then some) are technically reserved words,  
although the editor colours them differently, to give you a hint that it could be rather 
foolish to use them as identifiers:  
    ...           free           ... 
I think there's a bit of code somewhere that only allows some such things to be declared within the /builtins directory, if I find it again I'll think about adding some more of the dangerous ones to it.

new topic     » goto parent     » topic index » view message » categorize

6. Re: Phix plus BzScript

Thanks for that. I'm new to Phix and so I still have docs to read. But, be assured, I'm reading them. It's the fastest way to get up to speed.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu