There are two kinds of errors that Basis can find.

  • Syntax errors occur during the parsing of input code, and are caused by grammatically incorrect statements.
    Typical errors might be an illegal character in the input, a missing operator, two operators in a row,
    two statements on the same line with no intervening semicolon, unbalanced parentheses, a misplaced reserved word, etc.

  •  Semantic errors occur during the execution of the code, after it has been parsed as grammatically correct.
    These have to do not with how statements are constructed, but with what they mean.
    Such things as incorrect variable types or sizes, nonexistent variables, subscripts out of range, and the like, are semantic errors.

Basis is a single-pass  parser, that is, it looks at its input only once.

It also is a one-look ahead  parser, meaning that at the most it is never looking more than one symbol ahead of the current context.

By the time a syntax error has been detected, it is likely that a lot of the context information to the left of the error has already been lost.

The diagnostic information that Basis gives attempts to be as useful as possible,

but because of the very limited context information available, it is far from perfect.

Semantic errors are often possible to diagnose more precisely.

We have attempted to make the semantic error information supplied as useful as possible.

Sometimes some of the information is only useful to someone familiar with the internals of Basis;

but we hope that in most cases it will help you find your error.

Syntax Error:

error due to missing colon, semicolon, parenthesis, etc.

Syntax is the way in which we construct sentences by following principles and rules.

Example: In C++, it would be a syntax error to say

int x = "five";

This will not compile because it does not follow the syntax of the language and does not make any sense to the compiler.

Semantic Error:

it is a logical error. it is due to wrong logical statements.

Semantics is the interpretations of and meanings derived from the sentence transmission and understanding of the message.

Semantics errors are Logical, while Syntax errors are code errors.

Example: A semantic error would compile, but be incorrect logically:

const int pi = 12345;

Your program will likely compile and run without error but your results will be incorrect.

(Note that these types of errors are usually much harder to debug)

Syntactic and Semantic Errors的更多相关文章

  1. Type Systems

    This section deals with more theoretical aspects of types. A type system is a set of rules used by a ...

  2. Understanding Tensorflow using Go

    原文: https://pgaleone.eu/tensorflow/go/2017/05/29/understanding-tensorflow-using-go/ Tensorflow is no ...

  3. 2016年最新mac下vscode配置golang开发环境支持debug

    网上目前还找不到完整的mac下golang环境配置支持,本人配置成功,现在整理分享出来. mac最好装下xcode,好像有依赖关系安装Homebrew打开终端窗口, 粘贴脚本执行/usr/bin/ru ...

  4. coffeescript 1.8.0 documents

    CoffeeScript is a little language that compiles into JavaScript. Underneath that awkward Java-esque ...

  5. 6.00.1x Introduction to computation

    6.00 Introduction to Computer Science                  and  Programming • Goal: –Become skillful at ...

  6. Word2vec教程

    Word2vec Tutorial RADIM ŘEHŮŘEK 2014-02-02GENSIM, PROGRAMMING157 COMMENTS I never got round to writi ...

  7. coursera课程Text Retrieval and Search Engines之Week 1 Overview

    Week 1 OverviewHelp Center Week 1 On this page: Instructional Activities Time Goals and Objectives K ...

  8. 【DeepLearning】一些资料

    记录下,有空研究. http://nlp.stanford.edu/projects/DeepLearningInNaturalLanguageProcessing.shtml http://nlp. ...

  9. Chapter 4 Syntax Analysis

    Chapter 4 Syntax Analysis This chapter is devoted to parsing methods that are typically used in comp ...

随机推荐

  1. CSS background汇总

    本文更新版本 ,请跳转 所有背景属性都不能继承. 1.    background-color 所有元素都能设置背景颜色. background-color的默认值是transparent:也就是说, ...

  2. WebBrowserのIEバージョンを最新にする。

    WindowsフォームでWebBrowserコントロールを配置すると.IEのバージョンが 7 と古い.レジストリをいじると.IE11の Edgeモードに変更できる(参考記事).デザイン画面でWebBr ...

  3. 批量初始化数组和memset函数

    对于数组的初始化有一下三种方式: int  a[]={1,2,3,4,5} //通过判断初始化值得个数来却仍数组长度 int b[5]={1,2,3} //数组长度为5,可是初始值却只有三个,因此,不 ...

  4. 更换网页tab标题图标

    在首页HTML文件中,加入link命令,<link>是放在<head>与</head>之间 例如下面这样: <HEAD><link rel = & ...

  5. Java编程的逻辑 (42) - 排序二叉树

    本系列文章经补充和完善,已修订整理成书<Java编程的逻辑>,由机械工业出版社华章分社出版,于2018年1月上市热销,读者好评如潮!各大网店和书店有售,欢迎购买,京东自营链接:http:/ ...

  6. HttpClient-----待补充

    1.简介 HTTP 协议可能是现在 Internet 上使用得最多.最重要的协议了,越来越多的 Java 应用程序需要直接通过 HTTP 协议来访问网络资源.虽然在 JDK 的 java.net 包中 ...

  7. valgrind 内存调试工具

    一.valgrind 是运行在linux系统下的内存调试工具,支持很多对象:memcheck.addrcheck.cachegrind.Massif.helgrind.Callgrind等.使用val ...

  8. linux timer operate

    1.gettimeofday()    ---->   http://www.linuxidc.com/Linux/2012-06/61903.htm   (一般)

  9. 前端Hack之XSS攻击个人学习笔记

    简单概述 **        此篇系本人两周来学习XSS的一份个人总结,实质上应该是一份笔记,方便自己日后重新回来复习,文中涉及到的文章我都会在末尾尽可能地添加上,此次总结是我在学习过程中所写,如有任 ...

  10. js数组去重与性能分析(时间复杂度很重要)

    随着js的深入和实际项目对性能的要求,算法的简单实现已经不能满足需要,在不同的应用场景下,时间复杂度很重要. 首先是创建数组与性能处理函数: // 保证时间差的明显程度,创建不同量级的数组,size为 ...