Radicalc  Check-in [2fd6968e53]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:relational operators
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:2fd6968e5352e47f2b4847e0fc80ff7003d336cba492a54e020bf4f88740854b
User & Date: athaudia 2017-07-30 12:16:08
Context
2017-07-30
14:27
loads check-in: 8af915788d user: athaudia tags: trunk
12:16
relational operators check-in: 2fd6968e53 user: athaudia tags: trunk
11:59
operator precedence implemented (i think) check-in: 848be520eb user: athaudia tags: trunk
Changes

Changes to src/radicalc.ne.

99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114















































115
116
117
118
119
120
121
Return -> "return" (_ Expr):? {%
	function(d) { return {
		type: "return",
		expr: d[1]?d[1][1]:null
	}}
%}

Expr -> AddSub {% id %}

ParenExpr ->
	"(" _ AddSub _ ")" {% function(d) {return d[2]} %}
|	VarUse  {% id %}
|	LitInt  {% id %}
|	LitStr  {% id %}
|	FunCall {% id %}

















































AddSub ->
	AddSub _ "+" _ MulDiv {%
		function(d) { return {
			type: "funCall",
			name: "add",
			params: [d[0], d[4]]







|


|





>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
Return -> "return" (_ Expr):? {%
	function(d) { return {
		type: "return",
		expr: d[1]?d[1][1]:null
	}}
%}

Expr -> RelEq {% id %}

ParenExpr ->
	"(" _ RelEq _ ")" {% function(d) {return d[2]} %}
|	VarUse  {% id %}
|	LitInt  {% id %}
|	LitStr  {% id %}
|	FunCall {% id %}

RelEq ->
	RelEq _ "==" _ Rel {%
		function(d) { return {
			type: "funCall",
			name: "is_eq",
			params: [d[0], d[4]]
		}}
	%}
|	RelEq _ "!=" _ Rel {%
		function(d) { return {
			type: "funCall",
			name: "is_not_eq",
			params: [d[0], d[4]]
		}}
	%}
|	Rel {% id %}

Rel ->
	Rel _ "<" _ AddSub {%
		function(d) { return {
			type: "funCall",
			name: "is_less",
			params: [d[0], d[4]]
		}}
	%}
|	Rel _ "<=" _ AddSub {%
		function(d) { return {
			type: "funCall",
			name: "is_less_or_eq",
			params: [d[0], d[4]]
		}}
	%}
|	Rel _ ">" _ AddSub {%
		function(d) { return {
			type: "funCall",
			name: "is_greater",
			params: [d[0], d[4]]
		}}
	%}
|	Rel _ ">=" _ AddSub {%
		function(d) { return {
			type: "funCall",
			name: "is_greater_or_eq",
			params: [d[0], d[4]]
		}}
	%}
|	AddSub {% id %}

AddSub ->
	AddSub _ "+" _ MulDiv {%
		function(d) { return {
			type: "funCall",
			name: "add",
			params: [d[0], d[4]]