Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Vihan <contact@vihan.org>
- Loading branch information
Showing
10 changed files
with
229 additions
and
12 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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{ | ||
"name": "cheddar-lang-beta", | ||
"description": "Cheddar beta release channel", | ||
"homepage": "http://cheddar.vihan.org/", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/cheddar-lang/Cheddar.git" | ||
}, | ||
"author": "Vihan <contact@vihan.org> (http://vihan.org/)", | ||
"tags": [ | ||
"javascript", | ||
"language", | ||
"interpreter", | ||
"cheddar", | ||
"cheese", | ||
"food" | ||
], | ||
"version": "1.0.0", | ||
"dependencies": { | ||
"atob": "^2.0.3", | ||
"bases": "^0.2.1", | ||
"btoa": "^1.1.2", | ||
"colors": "^1.1.2", | ||
"commander": "^2.9.0", | ||
"crypto": "0.0.3", | ||
"readline": "^1.3.0", | ||
"xregexp": "^3.1.1" | ||
}, | ||
"bin": { | ||
"cheddar-beta": "dist/cli/cheddar" | ||
}, | ||
"scripts": { | ||
"prepublish": "make", | ||
"build": "make build", | ||
"test": "make test", | ||
"start": "./dist/cli/cheddar", | ||
"coveralls": "make test && cat ./coverage/lcov.info | ./node_modules/.bin/coveralls", | ||
"browser_build": "make browser_build" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.11.4", | ||
"babel-core": "^6.13.2", | ||
"babel-istanbul": "^0.11.0", | ||
"babel-plugin-add-module-exports": "^0.2.1", | ||
"babel-plugin-transform-class-properties": "^6.11.5", | ||
"babel-preset-es2015": "^6.13.2", | ||
"browserify": "^13.1.0", | ||
"chai": "^3.5.0", | ||
"codecov.io": "^0.1.6", | ||
"coveralls": "^2.11.12", | ||
"install": "^0.8.1", | ||
"mocha": "^3.0.1", | ||
"npm": "^3.10.6", | ||
"remap-istanbul": "^0.6.4" | ||
}, | ||
"main": "dist/cli/cheddar", | ||
"directories": { | ||
"test": "test" | ||
}, | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/cheddar-lang/Cheddar/issues" | ||
}, | ||
"config": { | ||
"unsafe-perm": true | ||
} | ||
} |
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
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
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,29 @@ | ||
import CheddarLexer from '../../../tok/lex'; | ||
import CheddarCodeblock from '../../../patterns/block'; | ||
import CheddarCustomLexer from '../../../parsers/custom'; | ||
|
||
import CheddarArray from '../../../parsers/array'; | ||
import CheddarVariable from '../../../literals/var'; | ||
|
||
import {KEEP_ITEM} from '../../../consts/err'; | ||
|
||
import {UOP, OP} from '../../../consts/ops'; | ||
|
||
export default class ClassStateOp extends CheddarLexer { | ||
exec(tokenizer) { | ||
this.open(false); | ||
|
||
return this.grammar(true, | ||
[ | ||
'unary', KEEP_ITEM, 'op', UOP, | ||
CheddarCustomLexer(CheddarArray, '(', ')', CheddarVariable), | ||
CheddarCustomLexer(CheddarCodeblock, tokenizer) | ||
], | ||
[ | ||
'binary', KEEP_ITEM, 'op', OP, | ||
CheddarCustomLexer(CheddarArray, '(', ')', CheddarVariable), | ||
CheddarCustomLexer(CheddarCodeblock, tokenizer) | ||
] | ||
); | ||
} | ||
} |
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,11 +1,21 @@ | ||
class Animal (private string: name, public number: age) { | ||
class Animal (public string: name, public number: age) { | ||
init { | ||
print "Created an animal named %s" % self.name | ||
print "Created an animal named %s" % self.name; | ||
} | ||
|
||
func getName -> self.name | ||
binary op + (a, b) { | ||
print a.name; | ||
print b.name; | ||
} | ||
|
||
func getName -> self.name; | ||
func getAge -> self.age | ||
} | ||
|
||
let myDog: Animal = Animal { "Max", 3 }; | ||
print "It is %d years old" % myDog.age; | ||
print "It's name is %s" % myDog.getName(); | ||
print "It's name is %s" % myDog.getName(); | ||
print "It's age is %d" % myDog.getAge(); | ||
|
||
let myGoat: Animal = Animal { "Downgoat", 5 }; | ||
print myDog + myGoat; |