Last active
May 7, 2018 03:35
-
-
Save Moligaloo/566a694db978318f8eb8c27f6b9417db to your computer and use it in GitHub Desktop.
Directly parse C function declaration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env io | |
CFunction := Object clone do( | |
returnType ::= nil | |
name ::= nil | |
paramTypes ::= nil | |
curlyBrackets := method( | |
msg_list := list() | |
msg := call argAt(0) | |
while(msg, | |
if(msg name != ";", | |
msg_list push(msg) | |
) | |
msg = msg next | |
) | |
Range 0 to (msg_list size / 2 - 1) map(i, | |
self clone setReturnType(msg_list at(i*2) name) setName(msg_list at(i*2+1) name) setParamTypes(msg_list at(i*2+1) arguments map(name)) | |
) | |
) | |
) | |
CFunction { | |
int strcmp(string, string); | |
int strlen(string); | |
void exit(); | |
} println |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment