aboutsummaryrefslogtreecommitdiff
path: root/sem1/osc/mm11/regn2/regn.l
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2019-10-24 09:17:29 +0200
committerJulian T <julian@jtle.dk>2019-10-24 09:18:01 +0200
commit5bc38338c79ef313f639696ec85e424c5d9c0b0c (patch)
tree92e0fa72ed025ea2dc23aff399546a3eb19e5252 /sem1/osc/mm11/regn2/regn.l
parentad2bc056ae684f8de57f2ff880e51440d07ee04a (diff)
Added regn2
Diffstat (limited to 'sem1/osc/mm11/regn2/regn.l')
-rw-r--r--sem1/osc/mm11/regn2/regn.l27
1 files changed, 27 insertions, 0 deletions
diff --git a/sem1/osc/mm11/regn2/regn.l b/sem1/osc/mm11/regn2/regn.l
new file mode 100644
index 0000000..9988ddd
--- /dev/null
+++ b/sem1/osc/mm11/regn2/regn.l
@@ -0,0 +1,27 @@
+%{
+#include <math.h>
+#include <string.h>
+#include "regn.tab.h"
+%}
+
+realtal ([0-9]+|([0-9]*\.[0-9]+))([eE][-+]?[0-9]+)?
+op_log log
+op_exp exp
+op_sqrt sqrt
+
+%%
+{realtal} {yylval.dval = atof(yytext);
+ return TAL;}
+{op_log} {return LOG;}
+{op_exp} {return EXP;}
+{op_sqrt} {return SQRT;}
+
+[ \t] ;
+
+
+'$' {return 0;}
+
+\n|. {return yytext[0];}
+
+%%
+