Created
May 27, 2015 18:58
-
-
Save haskellcamargo/36f65b7fe5a794b443f4 to your computer and use it in GitHub Desktop.
Pre-processor example
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
%{ | |
#define yes true | |
#ignore (@) ; ignore shut up operator | |
#token T_CONSTANT_ENCAPSED_STRING("foo") T_CONSTANT_ENCAPSED_STRING("bar") | |
#translate <[T_STRING]>\<<T>\> => { | |
class { | |
public function mix(<T> $arg) { | |
test::mix($this, $arg); | |
} | |
} | |
} | |
}% | |
-- TODO: Continue | |
entry-point = "%{", { definition, line-break }, "%}" ; | |
definition = define | |
| ignore ; | |
line-break = "\n" | |
| "\r" | |
| "\r\n" ; | |
define = "#define", valid-value, valid-value ; | |
valid-value = T_STRING | |
| "(", ? .* ?, ")" ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment