Skip to content
This repository was archived by the owner on Jun 1, 2022. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions .yalc/tony-lang/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,31 @@ module.exports = {
},
plugins: ['@typescript-eslint'],
rules: {
'max-lines-per-function': ['error', {
max: 20,
skipBlankLines: true,
skipComments: true,
}],
'max-lines-per-function': [
'error',
{
max: 25,
skipBlankLines: true,
skipComments: true,
},
],
'max-params': ['error', 5],
'sort-imports': 'error',
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/member-delimiter-style': ['error', {
multiline: {
delimiter: 'none',
'@typescript-eslint/member-delimiter-style': [
'error',
{
multiline: {
delimiter: 'none',
},
singleline: {
delimiter: 'semi',
},
},
singleline: {
delimiter: 'semi',
}
}],
],
},
overrides: [
{
Expand Down
2 changes: 2 additions & 0 deletions .yalc/tony-lang/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
8 changes: 4 additions & 4 deletions .yalc/tony-lang/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "tony-lang",
"version": "0.1.4-afbd7cb8",
"version": "0.1.4-dae48e8c",
"description": "The Tony programming language",
"main": "dist/src/index.js",
"types": "tony-lang.d.ts",
"scripts": {
"build": "babel . --ignore dist,node_modules --out-dir dist --extensions .ts",
"start": "nodemon --watch src --watch test --exec 'yarn build' -e ts",
"lint": "prettier --check src test && eslint src test --ext .ts",
"prettier": "prettier --write src test",
"lint": "prettier --check '**/*.{ts,js}' && eslint src test --ext .ts",
"prettier": "prettier --write '**/*.{ts,js}'",
"test": "ava dist/test/index.test.js"
},
"engines": {
Expand All @@ -28,7 +28,7 @@
},
"homepage": "https://github.com/tony-lang/tony#readme",
"dependencies": {
"core-js": "^3.6.5",
"core-js": "^3.6.4",
"deep-equal": "^2.0.1",
"inquirer": "^7.1.0",
"mkdirp": "^1.0.3",
Expand Down
16 changes: 16 additions & 0 deletions .yalc/tony-lang/src/ast/Abstraction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { AbstractionBranch } from './AbstractionBranch'
import { SyntaxNode } from './SyntaxNode'

export class Abstraction extends SyntaxNode {
private _branches: AbstractionBranch[]

constructor(branches: AbstractionBranch[]) {
super()

this._branches = branches
}

get branches(): AbstractionBranch[] {
return this._branches
}
}
23 changes: 23 additions & 0 deletions .yalc/tony-lang/src/ast/AbstractionBranch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Block } from './Block'
import { Parameters } from './Parameters'
import { SyntaxNode } from './SyntaxNode'

export class AbstractionBranch extends SyntaxNode {
private _body: Block
private _parameters: Parameters

constructor(parameters: Parameters, body: Block) {
super()

this._parameters = parameters
this._body = body
}

get body(): Block {
return this._body
}

get parameters(): Parameters {
return this._parameters
}
}
25 changes: 25 additions & 0 deletions .yalc/tony-lang/src/ast/Access.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Expression } from './Expression'
import { ShorthandAccessIdentifier } from './ShorthandAccessIdentifier'
import { SyntaxNode } from './SyntaxNode'

type Accessor = ShorthandAccessIdentifier | Expression

export class Access extends SyntaxNode {
private _value: Expression
private _accessor: Accessor

constructor(value: Expression, accessor: Accessor) {
super()

this._value = value
this._accessor = accessor
}

get value(): Expression {
return this._value
}

get accessor(): Accessor {
return this._accessor
}
}
23 changes: 23 additions & 0 deletions .yalc/tony-lang/src/ast/Application.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Argument } from './Argument'
import { Expression } from './Expression'
import { SyntaxNode } from './SyntaxNode'

export class Application extends SyntaxNode {
private _arguments: Argument[]
private _value: Expression

constructor(value: Expression, args: Argument[]) {
super()

this._arguments = args
this._value = value
}

get arguments(): Argument[] {
return this._arguments
}

get value(): Expression {
return this._value
}
}
16 changes: 16 additions & 0 deletions .yalc/tony-lang/src/ast/Argument.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Expression } from './Expression'
import { SyntaxNode } from './SyntaxNode'

export class Argument extends SyntaxNode {
private _value: Expression | undefined

constructor(value?: Expression) {
super()

this._value = value
}

get value(): Expression | undefined {
return this._value
}
}
26 changes: 26 additions & 0 deletions .yalc/tony-lang/src/ast/Assignment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { DestructuringPattern } from './DestructuringPattern'
import { Expression } from './Expression'
import { IdentifierPattern } from './IdentifierPattern'
import { SyntaxNode } from './SyntaxNode'

export type AssignablePattern = IdentifierPattern | DestructuringPattern

export class Assignment extends SyntaxNode {
private _pattern: AssignablePattern
private _value: Expression

constructor(pattern: AssignablePattern, value: Expression) {
super()

this._pattern = pattern
this._value = value
}

get pattern(): AssignablePattern {
return this._pattern
}

get value(): Expression {
return this._value
}
}
16 changes: 16 additions & 0 deletions .yalc/tony-lang/src/ast/Block.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Expression } from './Expression'
import { SyntaxNode } from './SyntaxNode'

export class Block extends SyntaxNode {
private _expressions: Expression[]

constructor(expressions: Expression[]) {
super()

this._expressions = expressions
}

get expressions(): Expression[] {
return this._expressions
}
}
19 changes: 19 additions & 0 deletions .yalc/tony-lang/src/ast/Boolean.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { SyntaxNode } from './SyntaxNode'

export class Boolean extends SyntaxNode {
private _text: string

constructor(text: string) {
super()

this._text = text
}

get text(): string {
return this._text
}

get value(): boolean {
return this.text === 'true'
}
}
30 changes: 30 additions & 0 deletions .yalc/tony-lang/src/ast/Case.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Block } from './Block'
import { Expression } from './Expression'
import { SyntaxNode } from './SyntaxNode'
import { When } from './When'

export class Case extends SyntaxNode {
private _branches: When[]
private _else: Block | undefined
private _value: Expression

constructor(value: Expression, branches: When[], els?: Block) {
super()

this._branches = branches
this._else = els
this._value = value
}

get branches(): When[] {
return this._branches
}

get else(): Block | undefined {
return this._else
}

get value(): Expression {
return this._value
}
}
4 changes: 4 additions & 0 deletions .yalc/tony-lang/src/ast/Declaration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Assignment } from './Assignment'
import { Module } from './Module'

export type Declaration = Assignment | Module
14 changes: 14 additions & 0 deletions .yalc/tony-lang/src/ast/DestructuringPattern.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { ListPattern } from './ListPattern'
import { MapPattern } from './MapPattern'
import { PatternPair } from './PatternPair'
import { Rest } from './Rest'
import { ShorthandPairIdentifierPattern } from './ShorthandPairIdentifierPattern'
import { TuplePattern } from './TuplePattern'

export type DestructuringPattern =
| ListPattern
| MapPattern
| PatternPair
| Rest
| ShorthandPairIdentifierPattern
| TuplePattern
23 changes: 23 additions & 0 deletions .yalc/tony-lang/src/ast/ElseIf.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Block } from './Block'
import { Expression } from './Expression'
import { SyntaxNode } from './SyntaxNode'

export class ElseIf extends SyntaxNode {
private _body: Block
private _condition: Expression

constructor(condition: Expression, body: Block) {
super()

this._body = body
this._condition = condition
}

get body(): Block {
return this._body
}

get condition(): Expression {
return this._condition
}
}
16 changes: 16 additions & 0 deletions .yalc/tony-lang/src/ast/Export.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Declaration } from './Declaration'
import { SyntaxNode } from './SyntaxNode'

export class Export extends SyntaxNode {
private _declaration: Declaration

constructor(declaration: Declaration) {
super()

this._declaration = declaration
}

get declaration(): Declaration {
return this._declaration
}
}
40 changes: 40 additions & 0 deletions .yalc/tony-lang/src/ast/Expression.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { Abstraction } from './Abstraction'
import { Access } from './Access'
import { Application } from './Application'
import { Assignment } from './Assignment'
import { Case } from './Case'
import { Export } from './Export'
import { Identifier } from './Identifier'
import { If } from './If'
import { Import } from './Import'
import { InfixApplication } from './InfixApplication'
import { List } from './List'
import { ListComprehension } from './ListComprehension'
import { Literal } from './Literal'
import { Map } from './Map'
import { Module } from './Module'
import { Pipeline } from './Pipeline'
import { PrefixApplication } from './PrefixApplication'
import { Return } from './Return'
import { Tuple } from './Tuple'

export type Expression =
| Abstraction
| Access
| Application
| Assignment
| Case
| Export
| Identifier
| If
| Import
| InfixApplication
| List
| ListComprehension
| Literal
| Map
| Module
| Pipeline
| PrefixApplication
| Return
| Tuple
Loading