-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e837ab0
commit 8f21d7e
Showing
12 changed files
with
60 additions
and
9 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/** | ||
* @todo @ethanthatonekid write tests that reflect cartridge api design/usage | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** | ||
* @todo @ethanthatonekid pass all tests in ./cartridge.test.ts | ||
* @todo @ethanthatonekid refactor <https://github.com/EthanThatOneKid/fart/blob/c43f2333458b2cbc40d167610d87e2a2e3f89885/lib/gen/cart.ts> | ||
*/ | ||
export class Cartridge { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { Cartridge } from "./cartridge.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
// https://github.com/EthanThatOneKid/fart/blob/c43f2333458b2cbc40d167610d87e2a2e3f89885/lib/reg/registry.ts | ||
/** | ||
* @todo @ethanthatonekid refactor <https://github.com/EthanThatOneKid/fart/blob/c43f2333458b2cbc40d167610d87e2a2e3f89885/lib/reg/registry.ts> | ||
*/ | ||
export class Registry { | ||
constructor() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// TODO(@ethanthatonekid): create a repl around the Fart transpiler | ||
export class FartRepl { | ||
constructor() { | ||
} | ||
} |
File renamed without changes.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export type { FartTokenGenerator } from "./tokenize.ts"; | ||
export { tokenize } from "./tokenize.ts"; | ||
export { Token } from "./token.ts"; | ||
export { LEXICON, Lexicon } from "./lexicon.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,36 @@ | ||
import { Token, tokenize } from "../tokenize/mod.ts"; | ||
import { Cartridge } from "../cartridge/mod.ts"; | ||
import { TextBuilder } from "../text_builder/mod.ts"; | ||
import type { FartTokenGenerator } from "../tokenize/mod.ts"; | ||
|
||
export interface FartOptions { | ||
targetLanguage: "ts" | "go" | "json" | "html"; | ||
codeCartridges: CodeCartridge[]; | ||
codeCartridges: Cartridge[]; | ||
indentation: number; | ||
preserveComments: boolean; | ||
} | ||
|
||
interface TranspilationContext { | ||
tokenizer: FartTokenGenerator | null; | ||
builder: TextBuilder; | ||
prevTokens: Token[]; | ||
} | ||
|
||
export const transpile = (code: string, options: FartOptions): string => { | ||
const INITIAL_TRANSPILATION_CONTEXT: TranspilationContext = Object.freeze({ | ||
tokenizer: null, | ||
builder: new TextBuilder(), | ||
prevTokens: [], | ||
}); | ||
|
||
const initializeTranspilationContext = () => ({ | ||
...INITIAL_TRANSPILATION_CONTEXT, | ||
}); | ||
|
||
export const transpile = async ( | ||
code: string, | ||
options: FartOptions, | ||
): Promise<string> => { | ||
const ctx = initializeTranspilationContext(); | ||
ctx.tokenizer = tokenize(code); | ||
return ""; | ||
}; |
8f21d7e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failed to deploy: