Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unexpected keyword interface #191

Open
dy-tea opened this issue Dec 27, 2024 · 0 comments
Open

unexpected keyword interface #191

dy-tea opened this issue Dec 27, 2024 · 0 comments

Comments

@dy-tea
Copy link

dy-tea commented Dec 27, 2024

The keyword interface is not being renamed, causing invalid code to be translated.
Given the code below:

#include <stdio.h>

void print_interface(int interface) {
  printf("%d\n", interface);
}

int main() {
  print_interface(100);
  return 0;
}

c2v outputs:

❯ v translate test.c
C to V translator 0.4.1
  translating /home/dylan/test.c ... #include <stdio.h>

void print_interface(int interface) {
  printf("%d\n", interface);
}

int main() {
  print_interface(100);
  return 0;
}

path=/home/dylan/test.c
main loop 2
1FN DECL c_name="print_interface" cur_file="/home/dylan/test.c" node.location.file="/home/dylan/test.c"
1FN DECL c_name="main" cur_file="/home/dylan/test.c" node.location.file=""
test.v:5:20: error: invalid expression: unexpected keyword `interface`
    3 | 
    4 | fn print_interface(interface int) {
    5 |     C.printf(c'%d\n', interface)
      |                       ~~~~~~~~~
    6 | }
    7 |

Internal vfmt error while formatting file: /home/dylan/test.v.
 c2v translate_file() took    37 ms ; output .v file: test.v
Translated   1 files in    37 ms.

The below file is generated, which will not run:

@[translated]
module main

fn print_interface(interface int) {
	C.printf(c'%d\n', interface)
}

fn main() {
	print_interface(100)
	return 
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant