rename files
This commit is contained in:
parent
fa5389b828
commit
cbb5a02bd9
@ -1,5 +1,5 @@
|
|||||||
import { Pos } from "./Token.ts";
|
import { Pos } from "./token.ts";
|
||||||
import { VType } from "./vtypes.ts";
|
import { VType } from "./vtype.ts";
|
||||||
|
|
||||||
export type UnaryType = "not";
|
export type UnaryType = "not";
|
||||||
export type BinaryType =
|
export type BinaryType =
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { StmtKind } from "./ast.ts";
|
import { StmtKind } from "./ast.ts";
|
||||||
import { EType, Expr, Stmt } from "./ast.ts";
|
import { EType, Expr, Stmt } from "./ast.ts";
|
||||||
import { Pos } from "./Token.ts";
|
import { Pos } from "./token.ts";
|
||||||
import { VType, VTypeParam, vtypesEqual, vtypeToString } from "./vtypes.ts";
|
import { VType, VTypeParam, vtypesEqual, vtypeToString } from "./vtype.ts";
|
||||||
|
|
||||||
export class Checker {
|
export class Checker {
|
||||||
private fnReturnStack: VType[] = [];
|
private fnReturnStack: VType[] = [];
|
||||||
@ -206,8 +206,7 @@ export class Checker {
|
|||||||
this.report(
|
this.report(
|
||||||
`cannot assign to incompatible type` +
|
`cannot assign to incompatible type` +
|
||||||
`, got '${vtypeToString(value)}'` +
|
`, got '${vtypeToString(value)}'` +
|
||||||
`, expected '${
|
`, expected '${vtypeToString(
|
||||||
vtypeToString(
|
|
||||||
stmt.kind.subject.kind.sym.param.vtype!,
|
stmt.kind.subject.kind.sym.param.vtype!,
|
||||||
)
|
)
|
||||||
}'`,
|
}'`,
|
||||||
@ -410,8 +409,7 @@ export class Checker {
|
|||||||
}
|
}
|
||||||
this.report(
|
this.report(
|
||||||
`cannot apply binary operation '${expr.kind.binaryType}' ` +
|
`cannot apply binary operation '${expr.kind.binaryType}' ` +
|
||||||
`on types '${vtypeToString(left)}' and '${
|
`on types '${vtypeToString(left)}' and '${vtypeToString(right)
|
||||||
vtypeToString(right)
|
|
||||||
}'`,
|
}'`,
|
||||||
pos,
|
pos,
|
||||||
);
|
);
|
@ -1,4 +1,4 @@
|
|||||||
import { Pos, Token } from "./Token.ts";
|
import { Pos, Token } from "./token.ts";
|
||||||
|
|
||||||
export class Lexer {
|
export class Lexer {
|
||||||
private index = 0;
|
private index = 0;
|
@ -3,7 +3,7 @@ import { BinaryType, Expr, Stmt } from "./ast.ts";
|
|||||||
import { LocalLeaf, Locals, LocalsFnRoot } from "./lowerer_locals.ts";
|
import { LocalLeaf, Locals, LocalsFnRoot } from "./lowerer_locals.ts";
|
||||||
import { Ops } from "./mod.ts";
|
import { Ops } from "./mod.ts";
|
||||||
import { Assembler } from "./program_builder.ts";
|
import { Assembler } from "./program_builder.ts";
|
||||||
import { VType, vtypeToString } from "./vtypes.ts";
|
import { VType, vtypeToString } from "./vtype.ts";
|
||||||
|
|
||||||
export class Lowerer {
|
export class Lowerer {
|
||||||
private program = new Assembler();
|
private program = new Assembler();
|
@ -1,8 +1,8 @@
|
|||||||
import { Checker } from "./Checker.ts";
|
import { Checker } from "./checker.ts";
|
||||||
import { Lexer } from "./Lexer.ts";
|
import { Lexer } from "./lexer.ts";
|
||||||
import { Lowerer } from "./Lowerer.ts";
|
import { Lowerer } from "./lowerer.ts";
|
||||||
import { Parser } from "./Parser.ts";
|
import { Parser } from "./parser.ts";
|
||||||
import { Resolver } from "./Resolver.ts";
|
import { Resolver } from "./resolver.ts";
|
||||||
|
|
||||||
const text = await Deno.readTextFile("example.slg");
|
const text = await Deno.readTextFile("example.slg");
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import { Stmt } from "./ast.ts";
|
import { Stmt } from "./ast.ts";
|
||||||
import { Lexer } from "./Lexer.ts";
|
import { Lexer } from "./lexer.ts";
|
||||||
import { Parser } from "./Parser.ts";
|
import { Parser } from "./parser.ts";
|
||||||
|
|
||||||
export * from "./Parser.ts";
|
export * from "./parser.ts";
|
||||||
export * from "./ast.ts";
|
export * from "./ast.ts";
|
||||||
export * from "./arch.ts";
|
export * from "./arch.ts";
|
||||||
export * from "./Lexer.ts";
|
export * from "./lexer.ts";
|
||||||
export * from "./Token.ts";
|
export * from "./token.ts";
|
||||||
|
|
||||||
export async function compileWithDebug(filepath: string): Promise<Stmt[]> {
|
export async function compileWithDebug(filepath: string): Promise<Stmt[]> {
|
||||||
const text = await Deno.readTextFile(filepath);
|
const text = await Deno.readTextFile(filepath);
|
||||||
|
@ -8,8 +8,8 @@ import {
|
|||||||
Stmt,
|
Stmt,
|
||||||
StmtKind,
|
StmtKind,
|
||||||
} from "./ast.ts";
|
} from "./ast.ts";
|
||||||
import { Lexer } from "./Lexer.ts";
|
import { Lexer } from "./lexer.ts";
|
||||||
import { Pos, Token } from "./Token.ts";
|
import { Pos, Token } from "./token.ts";
|
||||||
|
|
||||||
export class Parser {
|
export class Parser {
|
||||||
private currentToken: Token | null;
|
private currentToken: Token | null;
|
||||||
@ -501,7 +501,7 @@ export class Parser {
|
|||||||
const pos = this.pos();
|
const pos = this.pos();
|
||||||
if (this.test("ident")) {
|
if (this.test("ident")) {
|
||||||
const ident = this.current().identValue!;
|
const ident = this.current().identValue!;
|
||||||
this.step()
|
this.step();
|
||||||
return this.etype({ type: "ident", value: ident }, pos);
|
return this.etype({ type: "ident", value: ident }, pos);
|
||||||
}
|
}
|
||||||
if (this.test("[")) {
|
if (this.test("[")) {
|
@ -6,7 +6,7 @@ import {
|
|||||||
StaticSyms,
|
StaticSyms,
|
||||||
Syms,
|
Syms,
|
||||||
} from "./resolver_syms.ts";
|
} from "./resolver_syms.ts";
|
||||||
import { Pos } from "./Token.ts";
|
import { Pos } from "./token.ts";
|
||||||
|
|
||||||
export class Resolver {
|
export class Resolver {
|
||||||
private root = new GlobalSyms();
|
private root = new GlobalSyms();
|
Loading…
Reference in New Issue
Block a user