From 1147af9edae756e6079dd95fdf75c6a23513d819 Mon Sep 17 00:00:00 2001 From: Stefano Sanfilippo Date: Sun, 23 Nov 2014 22:06:37 +0100 Subject: [PATCH] Handle shift operator at syntactic level. --- Monicelli.ll | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Monicelli.ll b/Monicelli.ll index 5e14c0d..dd35696 100644 --- a/Monicelli.ll +++ b/Monicelli.ll @@ -13,6 +13,8 @@ DIGIT [0-9] HEXDIGIT [0-9a-zA-Z] CHAR [a-zA-Z_] +%x shift + %% ("\r\n"|"\n") { lineNumber += 1; @@ -70,10 +72,16 @@ CHAR [a-zA-Z_] "diviso" { return OP_DIV; } -"sinistra" { +"con scappellamento a" { + BEGIN(shift); +} +"per" { + BEGIN(INITIAL); +} +"sinistra" { return OP_SHL; } -"destra" { +"destra" { return OP_SHR; } "minore di" {