Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit51022b4

Browse files
committed
file: add igpc/ast.js
1 parent2388fb7 commit51022b4

File tree

1 file changed

+169
-0
lines changed

1 file changed

+169
-0
lines changed

‎igpc/ast.js

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
varast=(function(exports){
2+
'use strict';
3+
4+
classProgram{
5+
constructor(body){
6+
this.body=body;
7+
}
8+
}
9+
10+
classType{
11+
constructor(name){
12+
this.name=name;
13+
}
14+
}
15+
16+
classIdentifier{
17+
constructor(name){
18+
this.name=name;
19+
}
20+
}
21+
22+
classLiteral{
23+
constructor(value,raw){
24+
this.value=value;
25+
this.raw=raw;
26+
}
27+
}
28+
29+
classVariableDeclaration{
30+
constructor(id,typeName){
31+
Object.assign(this,{ id, typeName});
32+
}
33+
}
34+
35+
classArrayDeclaration{
36+
constructor(id,property,typeName){
37+
Object.assign(this,{ id, property, typeName});
38+
}
39+
}
40+
41+
classMemberExpression{
42+
constructor(object,property){
43+
Object.assign(this,{ object, property});
44+
}
45+
}
46+
47+
classCallExpression{
48+
constructor(callee,args,isStatement=false){
49+
Object.assign(this,{ callee,arguments:args, isStatement});
50+
}
51+
}
52+
53+
classBinaryExpression{
54+
constructor(operator,left,right){
55+
Object.assign(this,{ operator, left, right});
56+
}
57+
}
58+
59+
classUnaryExpression{
60+
constructor(operator,argument){
61+
Object.assign(this,{ operator, argument});
62+
}
63+
}
64+
65+
classAssignmentExpression{
66+
constructor(operator,left,right){
67+
Object.assign(this,{ operator, left, right});
68+
}
69+
}
70+
71+
classLogicalExpression{
72+
constructor(operator,left,right){
73+
Object.assign(this,{ operator, left, right});
74+
}
75+
}
76+
77+
classInputStatement{
78+
constructor(id){
79+
this.id=id;
80+
}
81+
}
82+
83+
classOutputStatement{
84+
constructor(args){
85+
Object.assign(this,{arguments:args});
86+
}
87+
}
88+
89+
classCallStatement{
90+
constructor(argument){
91+
Object.assign(this,{ argument});
92+
}
93+
}
94+
95+
classReturnStatement{
96+
constructor(argument){
97+
Object.assign(this,{ argument});
98+
}
99+
}
100+
101+
classIfStatement{
102+
constructor(test,consequent,alternative=null){
103+
Object.assign(this,{ test, consequent, alternative});
104+
}
105+
}
106+
107+
classRepeatStatement{
108+
constructor(body,test){
109+
Object.assign(this,{ body, test});
110+
}
111+
}
112+
113+
classWhileStatement{
114+
constructor(test,body){
115+
Object.assign(this,{ body, test});
116+
}
117+
}
118+
119+
classForStatement{
120+
constructor(id,start,stop,body,step=1){
121+
Object.assign(this,{ id, start, stop, step, body});
122+
}
123+
}
124+
125+
classSwitchStatement{
126+
constructor(discriminant,cases){
127+
Object.assign(this,{ discriminant, cases});
128+
}
129+
}
130+
131+
classSwitchCase{
132+
constructor(test,consequent){
133+
Object.assign(this,{ test, consequent});
134+
}
135+
}
136+
137+
classFunctionDeclaration{
138+
constructor(id,params,body,procedure=false){
139+
Object.assign(this,{ id, params, body, procedure});
140+
}
141+
}
142+
143+
exports.Program=Program;
144+
exports.Type=Type;
145+
exports.Identifier=Identifier;
146+
exports.Literal=Literal;
147+
exports.VariableDeclaration=VariableDeclaration;
148+
exports.ArrayDeclaration=ArrayDeclaration;
149+
exports.MemberExpression=MemberExpression;
150+
exports.CallExpression=CallExpression;
151+
exports.BinaryExpression=BinaryExpression;
152+
exports.UnaryExpression=UnaryExpression;
153+
exports.AssignmentExpression=AssignmentExpression;
154+
exports.LogicalExpression=LogicalExpression;
155+
exports.InputStatement=InputStatement;
156+
exports.OutputStatement=OutputStatement;
157+
exports.CallStatement=CallStatement;
158+
exports.ReturnStatement=ReturnStatement;
159+
exports.IfStatement=IfStatement;
160+
exports.RepeatStatement=RepeatStatement;
161+
exports.WhileStatement=WhileStatement;
162+
exports.ForStatement=ForStatement;
163+
exports.SwitchStatement=SwitchStatement;
164+
exports.SwitchCase=SwitchCase;
165+
exports.FunctionDeclaration=FunctionDeclaration;
166+
167+
returnexports;
168+
169+
}({}));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp