Compiler/code generator: Difference between revisions

Content added Content deleted
(→‎{{header|M2000 Interpreter}}: change putc to prtc)
Line 2,722: Line 2,722:
Enum tok {
Enum tok {
gneg, gnot, gmul, gdiv, gmod, gadd, gle, gsub, glt
gneg, gnot, gmul, gdiv, gmod, gadd, gle, gsub, glt
gle, ggt, gge, geq, gne, gand, gor, gputc, gprti, gprts,
gle, ggt, gge, geq, gne, gand, gor, gprtc, gprti, gprts,
gif, gwhile, gAssign, gSeq, gstring, gidentifier, gint, gnone
gif, gwhile, gAssign, gSeq, gstring, gidentifier, gint, gnone
}
}
Line 2,733: Line 2,733:
Append symb, "LessEqual":=gle, "Greater":=ggt, "GreaterEqual":=gge, "Sequence":=gSeq
Append symb, "LessEqual":=gle, "Greater":=ggt, "GreaterEqual":=gge, "Sequence":=gSeq
Append symb, "Equal":=geq, "NotEqual":=gne, "And":=gand, "Or":=gor, "While":=gwhile
Append symb, "Equal":=geq, "NotEqual":=gne, "And":=gand, "Or":=gor, "While":=gwhile
Append symb, "Putc":=gputc,"Prti":=gprti,"Prts":=gprts, "Assign":=gAssign, "If":=gif
Append symb, "Putc":=gprtc,"Prti":=gprti,"Prts":=gprts, "Assign":=gAssign, "If":=gif
Append symb, "String":=gstring, "Identifier":=gidentifier, "Integer":=gint, ";", gnone
Append symb, "String":=gstring, "Identifier":=gidentifier, "Integer":=gint, ";", gnone


Line 2,827: Line 2,827:
CodeGenerator(t#val(1))
CodeGenerator(t#val(1))
}
}
case gneg to gnot, gputc to gprts
case gneg to gnot, gprtc to gprts
CodeGenerator(t#val(1)) : data code$(mid$(eval$(t#val(0)),2))
CodeGenerator(t#val(1)) : data code$(mid$(eval$(t#val(0)),2))
case gmul to gor
case gmul to gor