issue-#186 aligning code procedure syntax with docu

issue-#186 aligning code procedure syntax with docu

Postby Josef Templ » Wed May 09, 2018 9:49 am

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: 2038
Joined: Tue Sep 17, 2013 6:50 am

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

Postby Josef Templ » Wed May 09, 2018 9:11 pm

A possible fix has been committed on github.
For a test version see http://blackboxframework.org/unstable/issue-%23186/blackbox-1.7.2-a1.1021.zip.

For the changes see https://redmine.blackboxframework.org/projects/blackbox/repository/diff?utf8=%E2%9C%93&rev=b78e384b028bb74be095e1dcd3449b7756f7082e&rev_to=a8b5479d55774c467572f100314900a4d9f1453b.

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
User avatar
Josef Templ
 
Posts: 2038
Joined: Tue Sep 17, 2013 6:50 am

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

Postby luowy » Thu May 10, 2018 2:15 am

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
luowy
 
Posts: 226
Joined: Mon Oct 20, 2014 12:52 pm

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

Postby Josef Templ » Thu May 10, 2018 6:12 am

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: 2038
Joined: Tue Sep 17, 2013 6:50 am

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

Postby Josef Templ » Sat May 12, 2018 12:56 pm

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

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

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

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

Postby Robert » Sat May 12, 2018 3:53 pm

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
User avatar
Robert
 
Posts: 1023
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

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

Postby luowy » Sun May 13, 2018 1:36 am

elegant code! I have checked it;
luowy
 
Posts: 226
Joined: Mon Oct 20, 2014 12:52 pm


Return to Resolved (Bugs)

Who is online

Users browsing this forum: No registered users and 1 guest

cron