mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-10-30 16:17:05 +00:00 
			
		
		
		
	git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97966 91177308-0d34-0410-b5e6-96231b3b80d8
		
			
				
	
	
		
			37 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Standard ML
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Standard ML
		
	
	
	
	
	
| (*===----------------------------------------------------------------------===
 | |
|  * Abstract Syntax Tree (aka Parse Tree)
 | |
|  *===----------------------------------------------------------------------===*)
 | |
| 
 | |
| (* expr - Base type for all expression nodes. *)
 | |
| type expr =
 | |
|   (* variant for numeric literals like "1.0". *)
 | |
|   | Number of float
 | |
| 
 | |
|   (* variant for referencing a variable, like "a". *)
 | |
|   | Variable of string
 | |
| 
 | |
|   (* variant for a unary operator. *)
 | |
|   | Unary of char * expr
 | |
| 
 | |
|   (* variant for a binary operator. *)
 | |
|   | Binary of char * expr * expr
 | |
| 
 | |
|   (* variant for function calls. *)
 | |
|   | Call of string * expr array
 | |
| 
 | |
|   (* variant for if/then/else. *)
 | |
|   | If of expr * expr * expr
 | |
| 
 | |
|   (* variant for for/in. *)
 | |
|   | For of string * expr * expr * expr option * expr
 | |
| 
 | |
| (* proto - This type represents the "prototype" for a function, which captures
 | |
|  * its name, and its argument names (thus implicitly the number of arguments the
 | |
|  * function takes). *)
 | |
| type proto =
 | |
|   | Prototype of string * string array
 | |
|   | BinOpPrototype of string * string array * int
 | |
| 
 | |
| (* func - This type represents a function definition itself. *)
 | |
| type func = Function of proto * expr
 |