-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow arithmetic operators in macros (+,-,/ and *)
- Loading branch information
Showing
11 changed files
with
77 additions
and
9 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
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
26 changes: 26 additions & 0 deletions
26
tests/Visp.Compiler.UnitTests/snapshots/tests_macros_count-exprs-0.can parse.verified.txt
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,26 @@ | ||
// This file is auto-generated | ||
|
||
#nowarn "0020" // unused results from functions | ||
|
||
open Visp.Runtime.Library | ||
|
||
let state = { Todo = () } | ||
// line 8 @"count-exprs-0.visp" | ||
let macro_CountExprsExampleTest1 = "__MACRO_INIT__" | ||
// line 15 @"count-exprs-0.visp" | ||
let exprCount = | ||
// line 15 @"count-exprs-0.visp" | ||
(1) + | ||
((1) + | ||
((1) + | ||
((1) + | ||
((1) + | ||
((1) + | ||
(1)))))) | ||
// line 17 @"count-exprs-0.visp" | ||
let visp_result_todo = | ||
// line 17 @"count-exprs-0.visp" | ||
printfn ("exprs: %A") (exprCount) | ||
// line 17 @"count-exprs-0.visp" | ||
printfn ("%A") (visp_result_todo) | ||
|
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
4 changes: 4 additions & 0 deletions
4
tests/Visp.ExecutionTests/snapshots/tests_macros_count-exprs-0.can execute.verified.txt
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,4 @@ | ||
exprs: 7 | ||
() | ||
|
||
ExitCode: 0 |
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,17 @@ | ||
;; Copyright 2023 Ville Penttinen | ||
;; Distributed under the MIT License. | ||
;; https://github.com/vipentti/visp-fs/blob/main/LICENSE.md | ||
;; | ||
;; for basic syntax highlighting | ||
;; vim: set syntax=clojure: | ||
|
||
(syntax-macro CountExprsExampleTest1 | ||
[(_) 0] | ||
[(_ _) 1] | ||
[(_ head tail ...) | ||
(+ 1 (CountExprsExampleTest1 tail ...))] | ||
) | ||
|
||
(let exprCount (CountExprsExampleTest1 [] [] [] [] [] [] [])) | ||
|
||
(printfn "exprs: %A" exprCount) |