Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View nitin42's full-sized avatar
👋

Nitin Tulswani nitin42

👋
View GitHub Profile
@nitin42
nitin42 / universal-links-react-native.md
Last active February 16, 2024 11:45
Handling Universal Links in React Native web view
@nitin42
nitin42 / react-native-accordion.md
Last active March 27, 2023 18:40
Creating an accessible Accordion component in React Native
class Grouping extends Expression {
constructor(expression) {
super()
this.expression = expression
}
handle(visitor) {
return visitor.visitGroupingExpression(this)
}
}
class Unary extends Expression {
constructor(operator, right) {
super()
this.operator = operator
this.right = right
}
handle(visitor) {
return visitor.visitUnaryExpression(this)
}
class Literal extends Expression {
constructor(value) {
super()
this.value = value
}
handle(visitor) {
return visitor.visitLiteralExpression(this)
}
}
class Binary extends Expression {
constructor(left, operator, right) {
super()
this.left = left
this.operator = operator
this.right = right
}
handle(visitor) {
return visitor.visitBinaryExpression(this)
class Expression {
handle(visitor) {}
}
class Visitor {
visitBinaryExpression(binary) {}
visitUnaryExpression(unary) {}
visitLiteralExpression(literal) {}
visitGroupingExpression(grouping) {}
}
expression => binary | unary | grouping | literal
literal => "true" | "false" | number | string | "null"
grouping => "(" expression ")"
binary => expression operator expression
unary => ( "-" | "!" ) expression
(* 12 (- 10 20))