issue-#186 aligning code procedure syntax with docu

Post Reply
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

issue-#186 aligning code procedure syntax with docu

Post by Josef Templ »

Based on a report by Zorko on the BlackBox community forum I have created
https://redmine.blackboxframework.org/issues/186 for fixing an inconsistency
between the documentation and the parsing of code procedures.

Dev/Docu/P-S-I.odc specifies that code procedures are a comma-separated sequence of constant expressions.
Leading, trailing, or multiple adjacent commas are not allowed.
In addition, the docu allows arbitrary constant expressions, not only integer and string literals.
The parser in DevCPP.GetCode therefore needs to be aligned with the docu.

It is expected that there are no compatibility issues with existing code and if there are any,
they would be flagged by the compiler and the fix is trivial.

- Josef
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#186 aligning code procedure syntax with docu

Post by Josef Templ »

A possible fix has been committed on github.
For a test version see http://blackboxframework.org/unstable/i ... 1.1021.zip.

For the changes see https://redmine.blackboxframework.org/p ... a4d9f1453b.

The changes are:
1. illegal commas are marked as errors.
2. any constant expression resulting in an int or string is allowed.
This allows for example to use symbolic opcodes.

- Josef
luowy
Posts: 234
Joined: Mon Oct 20, 2014 12:52 pm

Re: issue-#186 aligning code procedure syntax with docu

Post by luowy »

I do not quite understand the intention of this change,What problem to solve? help the porting of external code ?
Is there some examples to explain it's new EBNF ?


luowy
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#186 aligning code procedure syntax with docu

Post by Josef Templ »

luowy wrote:I do not quite understand the intention of this change,What problem to solve? help the porting of external code ?
Is there some examples to explain it's new EBNF ?


luowy
In practice there is no difference at all. All code procedures that follow the grammar in P-S-I.odc will of course continue to compile.
P-S-I.odc specifies code procedures in the following way:
Code procedures make it possible to use special code sequences not generated by the compiler. They are declared using the following special syntax:

ProcDecl = PROCEDURE "[" SysFlag "]" IdentDef [FormalPars]
[ConstExpr {"," ConstExpr}] ";".
The only (minor) problem was that the compiler did not check all syntax errors.
It was for example possible to add a comma at the beginning or the end or in between.
In addition, it did not allow ConstExpr but only simple special cases of ConstExpr.
With this fix the compiler follows the specification in P-S-I.odc.

- Josef
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#186 aligning code procedure syntax with docu

Post by Josef Templ »

Has everybody (anybody?) reviewed and tested this change?

From my point of view it would be ready for voting.

- Josef
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: issue-#186 aligning code procedure syntax with docu

Post by Robert »

Josef Templ wrote:Has everybody (anybody?) reviewed and tested this change?

From my point of view it would be ready for voting.

- Josef
In Spain on motorbike; can't look at it for at least a week.
I assume that empty code procedures are still possible?
Robert
luowy
Posts: 234
Joined: Mon Oct 20, 2014 12:52 pm

Re: issue-#186 aligning code procedure syntax with docu

Post by luowy »

elegant code! I have checked it;
Post Reply