-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PARAMETERS, LOCAL DATA & CREATE STATEMENT #124
Conversation
|
This is wonderful! I'm going to test it asap! Thank you!! |
I changed the LOCAL DATA variables so they are no longer persistent, each invocation of a SUB-PROCEDURE will have its own variable (if you call it recursively this helps). I think that persistent variables weren't useful and I understand that maybe it was more "LDPLic" in a way, but I think usability is a priority here. |
I've been testing this PR for the last hour and I just love it. I do LOVE it. This is an absolute game changer, this makes the language so much useful, so much richer, I even started writing a true standard library with this. I can't stress enough how much this makes the language better. Just like when @dvkt implemented C++ Extensions, this has taken LDPL a big leap ahead and I cannot stress how much I thank you. Contributions like these are what made LDPL what it is today and I cannot be thankful enough for all the work this community has put into my little toy language, not so toy nor little anymore. It's truly a moving thing. When you consider this PR is done, just go ahead and merge it. I'll go create a new repository for the LDPL Standard Library and start preparing everything for the next LDPL release. It was going to be LDPL 3.0.6, but an add-on this big deserves a major version increase, so I'd say let's go ahead and call it LDPL 3.1.0. Just like when we leaped from LDPL 2.2.0 to 3.0.0 with C++ Extensions. Again, your work is wonderful and I thank you very, very much for your amazing contribution. |
Thank you for your kind words, this make me really happy! I added a new statement to take advantage of these new powerful sub-procedures:
(this keywords can change, they are just the first thing that came to me) The Example:
I think that this would be cool for libraries, what do you think? |
Naaaaaaaaaaaah I cannot believe this! This is wonderful! Amazing! @dvkt this is the macro thing we were looking for! This is amazing, Damián, you are incredible. Thank you very, very, very, very, very much for this! Incredible! This would be wonderful for libraries, I guess now the Standard Library must be rewritten! Haha! Really something, will get to it tomorrow! Thank you again!! |
ok, this is awesome! |
oh also @Lartu I think that this might be a good time to remind r/programmingLanguages that we exist :P |
Yes! This would be wonderful. Once we release 3.1.0 we should go rub it in their faces (? haha |
Types are always correct when add_call_code is called from a custom statement (this is checked by line_like)
If I create a new statement with the word |
Also I cannot create statements with spaces in them anymore 😞 (for instance, |
Sorry about that, this is fixed now! If you pass an invalid type to IS now it continues checking for others statements instead of treating it always like a variable declaration. |
Wonderful, thank you! Thank you for this awesome contribution!! |
This resolves #113. Currently only
LOCAL DATA
section is implemented for now, I'll implementPARAMETERS
later, you can review and test the code in the meantime.Example:
Output:
All the variable declaration statements where merged to only one if to reduce duplicated code.
We store in which subprocedure a variable was declared and when we expect some variable we search it in the current subprocedure and main variables. The function
variable_type
handles this.To keep the variable values persistent, we fix the C++ identifier based on the subprocedure (for example,
LVAR_SUBPR_FOO_VAR_I
) and declare it as a global variable.The
PROCEDURE:
label is optional if the subprocedure only has procedure statements. This was implemented with thein_procedure_section
function.