-
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
Showing
6 changed files
with
175 additions
and
11 deletions.
There are no files selected for viewing
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,90 @@ | ||
{} | ||
{ | ||
"vscode_custom_css.imports": [ | ||
"file:///Users/thutasann/.vscode/extensions/codevars.outrun-meets-synthwave-0.0.1/synthWaveStyles.css" | ||
], | ||
"eslint.workingDirectories": [{ "mode": "auto" }], | ||
"editor.fontLigatures": true, | ||
"workbench.tree.indent": 20, | ||
"editor.fontSize": 13, | ||
"editor.fontFamily": "\"Fira Code\",\"mononoki Nerd Font\", Menlo, Monaco, 'Courier New', monospace", | ||
"editor.cursorSmoothCaretAnimation": "on", | ||
"editor.cursorBlinking": "expand", | ||
"editor.lineHeight": 2, | ||
"editor.fontWeight": "normal", | ||
"editor.cursorStyle": "block-outline", | ||
"terminal.external.linuxExec": "iterm", | ||
"terminal.integrated.fontSize": 14, | ||
"workbench.iconTheme": "bearded-icons", | ||
"editor.wordWrap": "on", | ||
"prettier.configPath": ".prettierrc", | ||
"editor.formatOnSave": true, | ||
"[typescript]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
}, | ||
"[typescriptreact]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
}, | ||
"[javascriptreact]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
}, | ||
"reactSnippets.settings.prettierEnabled": true, | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": "never" | ||
}, | ||
"eslint.options": { | ||
"extensions": [".js", ".jsx", ".md", ".mdx", ".ts", ".tsx"] | ||
}, | ||
"eslint.validate": ["markdown", "mdx", "javascript", "javascriptreact", "typescript", "typescriptreact"], | ||
"files.associations": { | ||
"*.mdx": "mdx", | ||
"*.jade": "jade" | ||
}, | ||
"redhat.telemetry.enabled": true, | ||
"security.workspace.trust.untrustedFiles": "open", | ||
"css.lint.unknownAtRules": "ignore", | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"typescript.tsdk": "./node_modules/typescript/lib", | ||
"typescript.enablePromptUseWorkspaceTsdk": true, | ||
"git.enableSmartCommit": true, | ||
"git.confirmSync": false, | ||
"typescript.updateImportsOnFileMove.enabled": "never", | ||
"emmet.includeLanguages": { | ||
"javascript": "javascriptreact" | ||
}, | ||
"[source.css.styled]": { | ||
"editor.tabSize": 2, | ||
"editor.wordWrap": "on", | ||
"editor.autoClosingBrackets": "always", | ||
"editor.autoClosingQuotes": "always" | ||
}, | ||
"editor.quickSuggestions": { | ||
"other": true, | ||
"comments": false, | ||
"strings": true | ||
}, | ||
"javascript.updateImportsOnFileMove.enabled": "always", | ||
"liveshare.accessibility.soundsEnabled": true, | ||
"extensions.autoUpdate": "onlySelectedExtensions", | ||
"angular.experimental-ivy": true, | ||
"angular.forceStrictTemplates": true, | ||
"editor.unicodeHighlight.invisibleCharacters": false, | ||
"editor.unicodeHighlight.ambiguousCharacters": false, | ||
"svg.preview.boundingBox": true, | ||
"svg.preview.transparencyGrid": true, | ||
"go.toolsManagement.autoUpdate": true, | ||
"git.openRepositoryInParentFolders": "always", | ||
"nxConsole.showNodeVersionOnStartup": false, | ||
"editor.largeFileOptimizations": false, | ||
"prettier.documentSelectors": [".cs"], | ||
"gitlens.graph.minimap.enabled": false, | ||
"[csharp]": { | ||
"editor.defaultFormatter": "ms-dotnettools.csharp" | ||
}, | ||
"editor.minimap.renderCharacters": false, | ||
"workbench.colorTheme": "Outrun Electric Meets Synthwave", | ||
"workbench.tree.enableStickyScroll": false, | ||
"editor.stickyScroll.enabled": true, | ||
"workbench.editorAssociations": { | ||
"*.dll": "default" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { | ||
IStatement, | ||
IProgram, | ||
IExpression, | ||
IBinaryExpression, | ||
INumericLiteral, | ||
IIdentifierExpression, | ||
} from './ast.interface' | ||
import { Lexer } from '../lexer/lexer' | ||
import { TokenType, IToken } from '../lexer/lexer.interface' | ||
|
||
/** | ||
* Parser Object | ||
* @description | ||
* - the job of the parser is to take in our tokens that we created from our `tokenizer` | ||
*/ | ||
export class Parser { | ||
private readonly _lexer: Lexer | ||
private tokens: IToken[] = [] | ||
|
||
constructor(lexer: Lexer) { | ||
this._lexer = lexer | ||
} | ||
|
||
/** | ||
* produce AST fnc | ||
*/ | ||
public produceAST(sourceCode: string): IProgram { | ||
this.tokens = this._lexer.tokenize(sourceCode) | ||
|
||
const program: IProgram = { | ||
kind: 'Program', | ||
body: [], | ||
} | ||
|
||
// parse until end of the file | ||
while (this.notEOF()) { | ||
program.body.push(this.parseSTMT()) | ||
} | ||
|
||
return program | ||
} | ||
|
||
/** check token is EOF or not */ | ||
private notEOF(): boolean { | ||
return this.tokens[0].type !== TokenType.EOF | ||
} | ||
|
||
/** entry point of the parser */ | ||
private parseSTMT(): IStatement { | ||
// skip to parseExpr | ||
return this.parseExpr() | ||
} | ||
|
||
private parseExpr(): IExpression { | ||
return { kind: 'BinaryExpr' } | ||
} | ||
|
||
private parsePrimaryExpr(): IExpression { | ||
return { kind: 'Identifier' } | ||
} | ||
} |
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