Closed mingodad closed 1 month ago
Hello, see if it works now.
Thank you for reply ! Would be nice if you could add the script to test attached above and also the changes to make re-entrant and easier to use with the test script. It's still failing in some files (see bellow I've added the offending line) but probably it's code that need to be updated:
../../../c3c/build/lib/std/core/builtin.c3:146:48:
^
syntax error, unexpected '(', expecting ')'
-> yyparse return 1
== panicf(string, $$FILE, $$FUNC, $$LINE, $vasplat());
...
../../../c3c/build/lib/std/core/builtin_comparison.c3:100:23:
^
syntax error, unexpected '(', expecting '['
-> yyparse return 1
== return less(x, $vaarg(0)) ? x : $vaarg(0);
...
../../../c3c/build/lib/std/core/string.c3:37:26:
^
syntax error, unexpected '(', expecting ')'
-> yyparse return 1
== str.appendf(fmt, $vasplat());
...
../../../c3c/build/lib/std/core/types.c3:192:21:
^
syntax error, unexpected '(', expecting '['
-> yyparse return 1
== $if @typeid($vaexpr($i)) != $type_a:
...
../../../c3c/build/lib/std/math/math.c3:357:22:
^
syntax error, unexpected '(', expecting '['
-> yyparse return 1
== m = $$max(m, $vaarg($i));
...
../../../c3c/build/lib/std/net/inetaddr.c3:7:13:
^
syntax error, unexpected '(', expecting '}'
-> yyparse return 1
== UNSPECIFIED (os::AF_UNSPEC),
...
../../../c3c/build/lib/std/net/socket.c3:87:11:
^
syntax error, unexpected '(', expecting '}'
-> yyparse return 1
== REUSEADDR (os::SO_REUSEADDR),
...
Also it seems that CT_CONCAT_OP
doesn't have a defined rule:
../../../c3c/test/test_suite/compile_time/concat_test_cases.c3:3:25:
^
syntax error, unexpected CT_CONCAT_OP, expecting ';'
-> yyparse return 1
== var $x = int[2]{ 1, 2 } +++ int[2]{ 4, 5 };
Fixed and I integrated the script as well.
Thank you again !
Now fix/update the code that is shown with errors when running the script that parse all .c3
files is the remaining issue here.
Also why don't expose the c3c
lexer/parser in the lib.std.core
?
Like go
does here https://pkg.go.dev/go/parser@go1.23.1 https://pkg.go.dev/go/scanner@go1.23.1
The only errors I found were the ones from tests that were supposed to fail. Did you find any other?
When you run the script that parses .c3
files using the c3.l/grammar.y
don't you get the errors shown here https://github.com/c3lang/c3c/issues/1443#issuecomment-2351079735 ?
No, those look like they're failing on the old stdlib. The latest grammar will not accept deprecated syntax.
Oops ! My fault I didn't noticed that ../../../c3c/build/lib/std/core/
was an old local folder created by me, sorry !
Is everything looking good now then?
Yes, it's working as expected ! Thank you !
Please consider exposing the lexer/parser in lib/std
.
The c3c lexer is written in C so that's why it's not in the stdlib.
But it can be exposed as a wrapper around It.
It's not a library, it's tightly integrated with the compiler when it comes to memory management in particular.
It seems that the
grammar.y
is out of sync again.See attached my fixes/changes/improvements (mainly making it reentrant and fixing
import_paths
rule) and a script to test it over all.c3
files in this repository. Here are some of the failures:mygrammar.zip