Skip to content

Latest commit

 

History

History
56 lines (42 loc) · 1.37 KB

File metadata and controls

56 lines (42 loc) · 1.37 KB

Tactic

./logo.png

Tactic is a small Scheme like langauge in one file.

Syntax

Instead of parenthesis, Tactic use brackets. Characters and strings are delimited by the usual single and double quotes. Quoted (literal) list are lists begin with a leading l, quasiquoted list begin with a leading q, and unquoted expressions begin with a leading $. Lambdas begin with a leading ^. The idenity function has the following form:

^[x x]

A function is a list that’s car is the formal parameter list and the cdr is the body, when the formal parameters is a list the function takes multiple arguments:

^[[a b] [fn a b]]

Here are some valid Tactic definitions:

[def a 1]
[def b 2]
[def c ^[[a b] [cat a b]]]
[def d l[1 2 3]]
[def e q[$a $b 3]]
[def f ^[x [pow x 5]]
[def g 'c']
[def h "hello"]
[def i 3.14]

Rich Numbers

Since Tactic is Scheme like (non-algebraic) and does not use certain characters for syntax it supprts rich number literals that are written naturally. In Tactic these are all valid numbers: 12, 100.1, 1/3, 56%, 0x1a1c, 0b01010, 10^3, 34e13, 3+6i, 3i+4j+4k, 102,010,333.

Explicit lexing and parsing steps

Seperate and explicit steps for lexing and parsing to support precise and detailed error messages.