-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: directives to use minimal mode
- Loading branch information
Showing
13 changed files
with
117 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
25 changes: 25 additions & 0 deletions
25
compiler/test_data/compiler_tests/directives/minimal_mode.yaka
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
directive no_main | ||
directive no_stdlib | ||
directive apply_nativedefine | ||
directive ccode """ | ||
#ifndef max | ||
#define max(a, b) ((a) > (b) ? (a) : (b)) | ||
#endif | ||
|
||
#ifndef min | ||
#define min(a, b) ((a) < (b) ? (a) : (b)) | ||
#endif | ||
""" | ||
|
||
# Below wil be inlined | ||
@nativedefine("max") | ||
def max(a: i32, b: i32) -> i32: | ||
pass | ||
|
||
@nativedefine("min") | ||
def min(a: i32, b: i32) -> i32: | ||
pass | ||
|
||
def add(a: i32, b: i32) -> i32: | ||
return min(a, b) + max(a, b) | ||
|
19 changes: 19 additions & 0 deletions
19
compiler/test_data/compiler_tests/directives/minimal_mode.yaka.c
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// YK | ||
// --forward declarations-- | ||
int32_t yy__add(int32_t, int32_t); | ||
// --structs-- | ||
// --functions-- | ||
|
||
#ifndef max | ||
#define max(a, b) ((a) > (b) ? (a) : (b)) | ||
#endif | ||
|
||
#ifndef min | ||
#define min(a, b) ((a) < (b) ? (a) : (b)) | ||
#endif | ||
; | ||
int32_t yy__add(int32_t yy__a, int32_t yy__b) | ||
{ | ||
int32_t t__0 = (min(yy__a, yy__b) + max(yy__a, yy__b)); | ||
return t__0; | ||
} |
This file contains 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