Skip to content

Commit

Permalink
Added Definitions to the ast
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikael Bung committed Feb 23, 2010
1 parent 1bf0197 commit 0ccf872
Showing 1 changed file with 35 additions and 2 deletions.
37 changes: 35 additions & 2 deletions ast.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ data Pattern
data Declaration
= VarDef Pattern Expression [Where]
| FunDef Identifier [Pattern] Expression [Where] // Ambiguous
| FunDef Identifier [Pattern] Expression [Where] // ambigious with the above line when Pattern is an identifier and lenght [Pattern] == 0
| FunDefGuard Identifier [Pattern] [(Guard, Expression)] [Where]
Value
Expand Down Expand Up @@ -154,4 +154,37 @@ haskell.ast.PatternConstructor.prototype = haskell.ast.Pattern;
haskell.ast.PatternVariableBinding.prototype = haskell.ast.Pattern;
haskell.ast.PatternIgnored.prototype = haskell.ast.Pattern;
haskell.ast.PatternCombined.prototype = haskell.ast.Pattern;
haskell.ast.PatternConstant.prototype = haskell.ast.Pattern;
haskell.ast.PatternConstant.prototype = haskell.ast.Pattern;

haskell.ask.Decleration = function() {

};

haskell.ast.VarDef = function(pattern, expression, wheres) {
if (wheres==null)
{
wheres=[];
}
this.pattern = pattern;
this.expression = expression;
this.wheres = wheres;
};

haskell.ast.FunDef = function(identifier, patterns, expression, wheres) {
this.identifier = identifier;
this.patterns = patterns;
this.expression = expression;
this.wheres = wheres==null ? [] : wheres;
};


haskell.ast.FundDefGuard = function(identifier, patterns, guardExpressions, wheres) {
this.identifier = identifier;
this.patterns = patterns;
this.expression = expression;
this.wheres = wheres==null ? [] : wheres;
};

haskell.ast.VarDef.prototype = hashell.ast.Declaration;
haskell.ast.FunDef.prototype = hashell.ast.Declaration;
haskell.ast.FunGuardDef.prototype = hashell.ast.Declaration;

0 comments on commit 0ccf872

Please sign in to comment.