AutoCorrect
- This is still a work in progress. It may be changed in the future.
AutoCorrect is a golfed derivative of C, where every error in the code that the parser can find is corrected. Codes in AutoCorrect uses autocorrection as a way to remove characters that are arbitrarily unnecessary (such as closing brackets).
Autocorrecting
Autocorrection is performed when either the parser encountered a syntax error, or when a name hasn't been declared (while alternative names exists). Autocorrection should be exhaustive; it should consider every single possible corrections.
Syntax errors
On syntax errors, the parser corrects it by adding the expected character. If multiple suggestions exists, it chooses the most prioritized one (priority system is left to be implemented in the compiler), retrying with another suggestion if it's still invalid.
Undeclared names
On undefined names, the parser corrects it by choosing a name containing the same characters in the same order. For example, function name ps
could be corrected to puts
or fgetpos
, but not pow
or sprintf
.
There are priorities on choosing a name: (rules written first are prioritized)
- Suggestions with the least corrections are prioritized. For the function name
ps
,puts
is better thanprintf_s
. - Suggestions with the least correction chunks are prioritized. For the function name
lg
,log
with 1 chunk is better thanilogf
with 3 chunks. - Variable names takes priority above functions.
- On functions, consider the inputs of the functions.
p("Hello, world!
is better corrected toputs("Hello, world!");
instead ofpow("Hello, world!");
- By default, functions from the library
stdio.h
,stdlib.h
, andstddef.h
are prioritized, however this can be configured on the compiler.
Example codes
Since the compiler hasn't been implemented yet, these example codes might not work.
Hello, world!
m({p"Hello, world!
This possibly autocorrects to:
main(){puts("Hello, world!");}