Skip to content

Instantly share code, notes, and snippets.

@Dubhead
Created October 24, 2018 18:14
Show Gist options
  • Save Dubhead/84a1d9a6fcef57d8448265f8f90880b9 to your computer and use it in GitHub Desktop.
Save Dubhead/84a1d9a6fcef57d8448265f8f90880b9 to your computer and use it in GitHub Desktop.
term-rewriting rule in Kit
% cat src/test.kit
rules AddOne {
(ADD_ONE(${x: Int})) => x + 1;
}
using rules AddOne;
function main() {
var foo = ADD_ONE(42_i);
}
%
% kitc test
[2018-10-25 03:11:49.492853] ===> parsing and building module graph
[2018-10-25 03:11:49.508318] ===> processing C includes
[2018-10-25 03:11:49.666179] ===> resolving module types
[2018-10-25 03:11:49.691016] ===> typing module content
----------------------------------------
Error: src/test.kit:7: Unknown identifier: ADD_ONE
@src/test.kit:7:15-21
7 var foo = ADD_ONE(42_i);
^^^^^^^
[2018-10-25 03:11:49.709233] ===> total time: 0.216120481s
[2018-10-25 03:11:49.709540] ERR: compilation failed (1 errors)
%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment