Moved test file + parsed file to docs/samples
This commit is contained in:
28
docs/samples/test.vi.ast
Normal file
28
docs/samples/test.vi.ast
Normal file
@@ -0,0 +1,28 @@
|
||||
Program {
|
||||
statements = [
|
||||
Comment "Here is a brief sample of the\nlanguage and its syntax",
|
||||
Comment "Import statements",
|
||||
Import ["std", "collections"] ["Heap", "HashMap"],
|
||||
Comment "Function declaration with types",
|
||||
Function (IdentifierWithType "fizz-buzz" (Just "Str")) [IdentifierWithType "i" (Just "Num")] [
|
||||
Comment "This is technically a legal comment",
|
||||
Let (IdentifierWithType "fb" Nothing) (LiteralString ""),
|
||||
Conditional (BinaryOperation Equal (BinaryOperation Modulus (Variable "i") (LiteralInt 3)) (LiteralInt 0)) [
|
||||
Assignment "fb" (BinaryOperation Concat (Variable "fb") (LiteralString "fizz"))
|
||||
] Nothing,
|
||||
Conditional (BinaryOperation Equal (BinaryOperation Modulus (Variable "i") (LiteralInt 5)) (LiteralInt 0)) [
|
||||
Assignment "fb" (BinaryOperation Concat (Variable "fb") (LiteralString "buzz"))
|
||||
] Nothing,
|
||||
Conditional (FunctionCall "is-empty" [Variable "fb"]) [
|
||||
Return (Variable "i")
|
||||
] (Just [
|
||||
Return (Variable "fb")
|
||||
])
|
||||
],
|
||||
Comment "Function declaration without types",
|
||||
Function (IdentifierWithType "main" Nothing) [] [
|
||||
Const (IdentifierWithType "fb" (Just "Str")) (FunctionCall "fizz-buzz" []),
|
||||
Expr (FunctionCall "print" [Variable "fb"])
|
||||
]
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user