You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. Currently, as far as I can tell, the only way to practice writing code is to select the programming language in the settings, which will then let you type words from the standard library of that language. I think this could be improved upon by adding a mode that generates randomized syntactically correct code (Although without semantic checks like types for example).
An algorithm to generate random code like this is very simple. We just define a context free grammar thats similar to the language that needs to be added, like C for example. Then just randomly generate words using the production rules of the grammar, and pick variable names and literals from some list of words. Perhaps newlines should also be added after each statement.
I think this would be awesome because it finally allows practicing special characters like you would use them while coding. Keybr.com probably uses something similar.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi. Currently, as far as I can tell, the only way to practice writing code is to select the programming language in the settings, which will then let you type words from the standard library of that language. I think this could be improved upon by adding a mode that generates randomized syntactically correct code (Although without semantic checks like types for example).
An algorithm to generate random code like this is very simple. We just define a context free grammar thats similar to the language that needs to be added, like C for example. Then just randomly generate words using the production rules of the grammar, and pick variable names and literals from some list of words. Perhaps newlines should also be added after each statement.
I think this would be awesome because it finally allows practicing special characters like you would use them while coding. Keybr.com probably uses something similar.
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions