aboutsummaryrefslogtreecommitdiff
path: root/src/cljcc
diff options
context:
space:
mode:
Diffstat (limited to 'src/cljcc')
-rw-r--r--src/cljcc/parser.clj7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/cljcc/parser.clj b/src/cljcc/parser.clj
index a4d7492..77482f1 100644
--- a/src/cljcc/parser.clj
+++ b/src/cljcc/parser.clj
@@ -12,7 +12,7 @@
function = #'int\\b' identifier <'('> #'void\\b' <')'> <'{'> statement <'}'>
statement = #'return\\b' exp <';'>
exp = constant | unop exp | <'('> exp <')'>
- unop = #'-\\b' | #'~\\b'
+ unop = #'-' | #'~'
identifier = #'[a-zA-Z_]\\w*\\b'
constant = #'[0-9]+\\b'
keyword = #'int\\b' | #'return\\b' | #'void\\b'"
@@ -26,4 +26,9 @@
(comment
(parse "int main(void) {return 2;}")
+
+ (parse "int main(void) {
+return -(((((10)))));
+}")
+
,)