Re: Operator Precedence for Custom Code Generator

92 views
Skip to first unread message

Mark Friedman

unread,
Apr 11, 2023, 7:28:19 PM4/11/23
to blo...@googlegroups.com
Conor,

  As you're (mostly) using it, the scrub_ method is being used for statement blocks (i.e. the ones with a nextConnection) to ensure that code is generated for any subsequent statements (subject to the thisOnly argument).  However your last line seems to indicate that you want to include a precedence, but precedences are really only applicable to value blocks.  There are uses for scrub_ with value blocks, but even there the precedence would be returned (along with the code) in the generators for each of the specific value blocks, not in scrub_.

  I hope this makes sense.

-Mark


On Mon, Apr 10, 2023 at 8:34 AM Conor Keenan <conorke...@gmail.com> wrote:
Hi guys,

I'm trying to create my own code generator for the C programming language. When I add operator precedence to my code generator 'tiva' I'm unable to access the operator values in my block generators. It quite strange since I was able to access custom operator precedence in the JSON Generator Codelab. Can someone help me out?

Regards
ConorScreenshot 2023-04-10 163135.png

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/4bac6496-8271-4ba8-bb00-d4021e59db60n%40googlegroups.com.
Message has been deleted

Mark Friedman

unread,
Apr 13, 2023, 5:44:10 PM4/13/23
to blo...@googlegroups.com
Conor,

  Have you defined embeddedGenerator.PRECEDENCE?  If so, what errors are you getting?  Can you post any errors and stack traces you are getting in the browser's console?

-Mark


On Thu, Apr 13, 2023 at 1:35 PM Conor Keenan <conorke...@gmail.com> wrote:
Hi Mark,

Thanks for the reply. I still get this issue with valueToCode blocks as well. Sorry for posting that original image as it was misleading.

Regards

Screenshot 2023-04-13 162150.png

Conor Keenan

unread,
Apr 14, 2023, 9:40:54 AM4/14/23
to Blockly
Hi Mark, 

I think I've correctly defined all my order operators and the are the errors I'm receiving.I don't actually get any error when the app is running regarding precedence. However, I do get lots of errors regarding nameDB_getName(), when trying to retrieve a name of a variable.

Regards 
Conor
Screenshot 2023-04-14 at 13.56.37.pngScreenshot 2023-04-14 at 13.57.31.pngScreenshot 2023-04-14 at 14.33.50.png
Screenshot 2023-04-14 at 14.07.22.png
Screenshot 2023-04-14 at 14.33.50.png

Mark Friedman

unread,
Apr 14, 2023, 2:22:37 PM4/14/23
to blo...@googlegroups.com
Conor,

  Do you have your code available in a GitHub repo or other available location, by any chance?  Something strange appears to be going on, and the best way to diagnose it at this point, I think, would be to have access to the code. 

-Mark


Conor Keenan

unread,
Apr 14, 2023, 2:43:42 PM4/14/23
to Blockly
Hi Mark,

Really appreciate your help, I've Been stuck on this for weeks. Here's a link to my code on GitHub:

Regards
Conor

Conor Keenan

unread,
Apr 14, 2023, 2:45:24 PM4/14/23
to Blockly
P.S
If you run "npx @blockly/create-package app <application-name>" and add replace the files with the ones I uploaded on GitHub it should be able to run.

Mark Friedman

unread,
Apr 14, 2023, 3:50:54 PM4/14/23
to blo...@googlegroups.com
It looks like Maribeth addressed the primary issues in another thread, so I'll let that be the canonical thread.

-Mark


Reply all
Reply to author
Forward
0 new messages