Homoiconic C (HC) Language Support for VS Code
Syntax highlighting and language support for
Homoiconic C - a universal language
for code and data.
Features
Comprehensive Syntax Highlighting for all HC syntax elements:
- Special values:
() (nil), <> (all), ^ (parent), _ (anonymous), .
(this)
- Comments: inline
#...# and end-of-line #...
- Strings: double-quoted
"..." and backtick `...`
- Numbers: integer
123, binary 0b, octal 0o, hex 0x, exact decimal
123.456, rational 1/3, sequence 1.408.055.1212, quantity 9.8.m and
9.8.kg.m.s-2
- Time literals:
%date%, %time%, %datetime%
- BLOB literals: raw bytes
\n\content\ and base64 0sBase64
- Scope anchors:
$ (current file/module) and $$ (host namespace)
- Effect typing:
CONST, variable, mutable_, method_
- Access modifiers:
public, _protected, __private
- Operators:
+, -, *, /, =, <, >, ~, !, ?, :, |, &
- Size operators:
.#, .##, .### and .####, highlighted as names
- Frame delimiters:
{} (lazy), [] (array), () (expr)
Smart Bracket Matching for all frame types
Auto-closing Pairs for brackets, quotes, and comments
Comment Toggle Support with # delimiter
Installation
From VS Code Marketplace
Search for "Homoiconic C" in the Extensions view (Cmd+Shift+X /
Ctrl+Shift+X) and install.
From Source
cd vscode-extension
npm install -g @vscode/vsce
vsce package
code --install-extension hclang-*.vsix
Examples
Basic HC Code
# Define a property
.square {_ * _}
# Use it
square 5 # Returns 25
# Conditional expression
( 1 > 5 ) ? 100 : 10 # Returns 10
Numbers and Literals
# Various number formats
0b1101 # Binary
0o1337 # Octal
0xDEADBEEF # Hexadecimal
123.456 # Exact decimal
1/3 # Rational
1.408.055.1212 # Inert numeric sequence
9.8.m # Typed number, magnitude and unit
9.8.kg.m.s-2 # Composite unit with exponents
# Time and data
%2025-01-01% # Date literal
\5\Hello # Raw bytes
0sQmFzZTY0 # Base64
Identifiers and Effect Typing
# Effect typing
CONSTANT # Immutable constant (uppercase)
variable # Immutable variable
mutable_ # Mutable variable (trailing _)
method_ # Mutating method (the same trailing _)
# Access modifiers
public # Public (default)
_protected # Protected (single _)
__private # Private (double __)
# Semantic prefixes
.setter # Property setter
@control # Control or alias
$.property # Current file/module property
$$.property # Host-supplied property
Language Specification
For detailed language specification, see:
Development
Setup
git clone https://github.com/TheSwanFactory/hclang.git
cd hclang/vscode-extension
Testing Locally
Press F5 in VS Code to launch the extension in a new Extension Development
Host window.
Or use the command line:
code --extensionDevelopmentPath=/path/to/hclang/vscode-extension
Building and Publishing
Using Deno tasks from the repo root:
# Package the extension
deno task vscode:package
# Publish to marketplace
deno task vscode:publish
# Install locally
deno task vscode:install
Contributing
Contributions are welcome! Please see the
main repository for contribution
guidelines.
License
MIT - See LICENSE for details.
Links