SwitchLog: A Logic Programming Language for Network Switches

Vaibhav Mehta, Devon Loehr, John Sonchack, David Walker

Research output: Chapter in Book/Report/Conference proceedingConference contribution


The development of programmable switches such as the Intel Tofino has allowed network designers to implement a wide range of new in-network applications and network control logic. However, current switch programming languages, like P4, operate at a very low level of abstraction. This paper introduces SwitchLog, a new experimental logic programming language designed to lift the level of abstraction at which network programmers operate, while remaining amenable to efficient implementation on programmable switches. SwitchLog is inspired by previous distributed logic programming languages such as NDLog, in which programmers declare a series of facts, each located at a particular switch in the network. Logic programming rules that operate on facts at different locations implicitly generate network communication, and are updated incrementally, as packets pass through a switch. In order to ensure these updates can be implemented efficiently on switch hardware, SwitchLog imposes several restrictions on the way programmers can craft their rules. We demonstrate that SwitchLog can be used to express a variety of networking applications in a mere handful of lines of code.

Original languageEnglish (US)
Title of host publicationPractical Aspects of Declarative Languages - 25th International Symposium, PADL 2023, Proceedings
EditorsMichael Hanus, Daniela Inclezan
PublisherSpringer Science and Business Media Deutschland GmbH
Number of pages17
ISBN (Print)9783031248405
StatePublished - 2023
Event25th International Symposium on Practical Aspects of Declarative Languages, PADL 2023 - Boston, United States
Duration: Jan 16 2023Jan 17 2023

Publication series

NameLecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)
Volume13880 LNCS
ISSN (Print)0302-9743
ISSN (Electronic)1611-3349


Conference25th International Symposium on Practical Aspects of Declarative Languages, PADL 2023
Country/TerritoryUnited States

All Science Journal Classification (ASJC) codes

  • Theoretical Computer Science
  • General Computer Science


  • Data plane programming
  • Datalog
  • Logic programming
  • P4
  • Programmable networks


Dive into the research topics of 'SwitchLog: A Logic Programming Language for Network Switches'. Together they form a unique fingerprint.

Cite this