Add Expression type, Program is a list of Expressions
This commit is contained in:
		
							parent
							
								
									febc3c359f
								
							
						
					
					
						commit
						5ec2a11df1
					
				
					 1 changed files with 14 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -2,11 +2,21 @@
 | 
			
		|||
 * Eryn Wells <eryn@erynwells.me>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#[derive(Debug, PartialEq)]
 | 
			
		||||
pub struct Program { }
 | 
			
		||||
use lexer;
 | 
			
		||||
use types;
 | 
			
		||||
 | 
			
		||||
pub struct Program {
 | 
			
		||||
    forms: Vec<Expression>
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl Program {
 | 
			
		||||
    pub fn new() -> Program {
 | 
			
		||||
        Program { }
 | 
			
		||||
    pub fn new(forms: Vec<Expression>) -> Program {
 | 
			
		||||
        Program { forms: forms }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub enum Expression {
 | 
			
		||||
    EOF,
 | 
			
		||||
    Atom(Box<types::Value>),
 | 
			
		||||
    List { left: lexer::Token, expression: Vec<Box<Expression>>, right: lexer::Token },
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue