Talk:Compiler/syntax analyzer: Difference between revisions

mNo edit summary
 
(5 intermediate revisions by 3 users not shown)
Line 21:
 
You are correct. Thanks for catching this! I have modified the grammar. --[[User:Ed Davis|Ed Davis]] ([[User talk:Ed Davis|talk]]) 11:03, 23 October 2016 (UTC)
 
==prt_list production incorrect==
I think the prt_list production should be:
<pre>
prt_list = (String | expr) { ',' (String | expr) } ;
</pre>
because | is lower precedence than concatenation.
 
Yep, I agree. It has been corrected. Thanks for the catch! --[[User:Ed Davis|Ed Davis]] ([[User talk:Ed Davis|talk]]) 18:19, 22 April 2019 (UTC)
 
== Prtc node type documentation ambiguity ==
 
In the C reference implementation, the 'putc' operation gets a 'Prtc' node type. while print(expression) gets a 'Prti' node type. The task documentation on this issue does not make this clear (it looks like the original thought was print(expression) would get 'Prtc' and that somehow putc got misspelled and the tangle of ideas was never completely spelled out).
 
I hope it's acceptable to instead use a 'Putc' node type for the putc operation. --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 01:20, 21 January 2022 (UTC)
 
The three printing nodes types are:
*Prtc -- prints a character
*Prts -- prints a string
*Prti -- prints an integer
 
I used putc() for printing characters, because that is what C using.
For a Rosetta code task, adding printf() would have been too big, and puts() (from C) adds a newline, which I did not want.
So, I settled on putc() and print().
Of course, you are free to implement however you like, but it make not work with other implementations, e.g., you can intermix the C and Pything modules, because they use the same external names.
--[[User:Ed Davis|Ed Davis]] ([[User talk:Ed Davis|talk]]) 17:55, 21 January 2021 (UTC)
 
:And, I see that the vm implementation specifies a prtc instruction. So I guess I should go with that throughout. Thanks. --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 17:16, 29 January 2022 (UTC)
6,951

edits